Pages

Sunday, April 21, 2013

Error connecting to MySQL: Access denied for user: ‘da_admin@localhost’ (Using password: YES):

Today When connecting to the MySQL in DirectAdmin , I got this error and that would indicated that the “da_admin” user has not been setup correctly. To resolve this I did following:
1) You need to Make sure the root mysql password works. If you know it, Go to mysql,  If you don’t..  then mysql root password can be found in the /usr/local/directadmin/scripts/setup.txt , if it has not been deleted.
It’s under the header “mysql=”.
If it cannot be found, then mysqld will have to be restarted with the –skip-grant-tables option as follows :

==========================================

# [root@test ~]# service mysqld stop
# [root@test ~]# mysqld_safe –skip-grant-tables &

===========================================

This will  start up mysql without the need for a root password. Then run


# [root@test ~]# mysql
You must be enetered to mysql prompt without password, Now run the following command once you’re in:
————————————–
# mysql > use mysql
# mysql > UPDATE user SET password=PASSWORD(‘newpass’) WHERE user=’root’;
# mysql > FLUSH PRIVILEGES;
# mysql > quit
—————————————-
That will reset the root password for you.
killl all process of mysqld and restart the mysqld
# [root@test ~]# killall -9 mysqld_safe
# [root@test ~]# killall -9 mysqld
and start it again :
# [root@test ~]# /sbin/service mysqld start
Now next
2)Once the root mysql password is set, then you can start resetting the da_admin mysql user.
Run :
#  [root@test ~]# mysql -uroot -p
Then press enter. You’ll be asked for the password. Enter the password that you’ve reset in step 1. Once in mysql,
Run:
# mysql > GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY ‘newdapass’ WITH GRANT OPTION;
#  mysql > FLUSH PRIVILEGES;
# mysql > quit
This will  set the password for da_admin in mysql.
Next in step  3) Now you need to make sure it’s setup correctly for Direct Admin to use.
Edit /usr/local/directadmin/conf/mysql.conf and enter
===================
user=da_admin
passwd=newdapass
===================
4) Now test it in DirectAdmin. It should be fixed now!!!!!!!

No comments:

Post a Comment