Cannot connect with da_admin

x3s

New member
Joined
Jun 5, 2019
Messages
5
Hi Guys,

When I want to create a back-up I get this error:
Error connecting to MySQL: Access denied for user 'da_admin'@'localhost' (using password: YES)
<b>Repair guide: <a target=_blank href='http://help.directadmin.com/item.php?id=45'>http://help.directadmin.com/item.php?id=45</a></b>


If I follow the tutorial then I execute this commando's:
Code:
systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld

mysql mysql -e "UPDATE mysql.user SET authentication_string=PASSWORD('****') WHERE user='root'; FLUSH PRIVILEGES;"

systemctl unset-environment MYSQLD_OPTS
systemctl stop mysqld
systemctl start mysqld
mysql -uroot -p'*****' -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '*****';"
Then I get this error:
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Maybe it has something to do with this tutorial I followed:
https://help.directadmin.com/item.php?id=140

And executed this command exactly like this:
Code:
mysql -uda_admin -p --host=4.3.2.1
Mysql is running fine. Firewall is not running.

And when I edit:
/var/www/html/phpMyAdmin/config.inc.php

$cfg['Servers'][$i]['host'] = remote_server_address

I still can't connect..

Can you guys please help me out?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,818
Location
GMT +7.00
Hello,

At least 2 things might be wrong here:

1. The command which you start with mysql mysql -e should have only 1 mysql mention:

Code:
mysql -e

2. The part --host=4.3.2.1 should be used only if you host MySQL/MariaDB server outside of your DirectAdmin server. If you use the locally install SQL server, then the part should be omitted. If you really use a remote server, then 4.3.2.1 should be replaced by a real IP address of your SQL server.
 

x3s

New member
Joined
Jun 5, 2019
Messages
5
Hi,

Thanks for your quick response.
I just want to connect to da_admin from a remote connection.

When I execute this commando's I still get the same error:
Code:
systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld

mysql -e "UPDATE mysql.user SET authentication_string=PASSWORD('****') WHERE user='root'; FLUSH PRIVILEGES;"

systemctl unset-environment MYSQLD_OPTS
systemctl stop mysqld
systemctl start mysqld
mysql -uroot -p'*****' -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '*****';"
This is the error:
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 

x3s

New member
Joined
Jun 5, 2019
Messages
5
I know how to give access to a database from a user.
But I want to connect with da_admin to see all the databases.

I thinks it has something to do with this error I keep getting in directadmin:
An error occurred during the backup:

RoundCube Backup Error:
Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'da_admin'@'localhost' (using password: YES) in /usr/local/directadmin/scripts/backup_roundcube.php on line 114
Failed to connect to MySQL: (1045) Access denied for user 'da_admin'@'localhost' (using password: YES)


Error connecting to MySQL: Access denied for user 'da_admin'@'localhost' (using password: YES)
<b>Repair guide: <a target=_blank href='http://help.directadmin.com/item.php?id=45'>http://help.directadmin.com/item.php?id=45</a></b>
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,818
Location
GMT +7.00
The MySQL user da_admin is still an user even with more privileges, and hence you need to update allowed host for the user. By default user da_admin can be connected only from localhost.

The guide http://help.directadmin.com/item.php?id=45 is not applicable here, and you should remove changes from /usr/local/directadmin/conf/mysql.conf and /usr/local/directadmin/conf/my.conf done per instructions in https://help.directadmin.com/item.php?id=140

Connect to phpMyAdmin and update list of allowed hosts for user da_admin. Refer to official documentation for details.

Make sure MySQL is bind to 0.0.0.0:3306 and firewall does not block connections.
 

x3s

New member
Joined
Jun 5, 2019
Messages
5
Thanks for your response, I cannot undo the changes or don't know how to.

I removed everything from these two files (only user=da_admin and the password are in the file now):
/usr/local/directadmin/conf/my.cnf
/usr/local/directadmin/conf/mysql.conf

If I run this commando for example:
Code:
mysql -uroot -p
I get this error:
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
So I cannot execute this command to reset everything:
Code:
GRANT ALL PRIVILEGES ON *.* TO da_admin@0.0.0.0 WITH GRANT OPTION;
FLUSH PRIVILEGES;
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,818
Location
GMT +7.00
You try to connect as root, but you recover a password for another user da_admin.

A root's password to connect to MySQL can be found in /usr/local/directadmin/scripts/setup.txt, it is a line starting with mysql=
 

x3s

New member
Joined
Jun 5, 2019
Messages
5
I found the password located in the: /usr/local/directadmin/scripts/setup.txt file

But when I type:
Code:
mysql -uroot -p
And use the password from the file I still get the error:
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,818
Location
GMT +7.00
I believe you have all the needed instructions on how to recover a password to MySQL. If you can't manage to get it working you might need to get someone to fix it for you. You might contact either DirectAdmin support via tickets to get it resolved or me for a commercial support.
 
Top