Cannot create database with DirectAdmin


I see a lot of DirectAdmin users who cannot create a mysql database. When you see the following error, I am sure I can help you out:

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

First make sure your mysql root password is working, you can test it out using the following command:

# mysql -uroot -p

If it’s failing we have to reset the mysql root password, it is easy!

Restart mysql using the skip grand tables option:

# service mysqld stop
# mysqld_safe –skip-grant-tables &

Please notice: ‘skip’ has two dashes (-), but I cannot make the two dashes because of wordpress.

MySQL is not started with the skip grant tables option, so we can now log in with root without a password:

# mysql -u root

When sucessfully logged in perform the following commands:

use mysql
UPDATE user SET password=PASSWORD(‘newpass’) WHERE user=’root’;
FLUSH PRIVILEGES;
quit

Ok, mysql root password has been reset. We continue with changing the mysql password for user da_admin. First start mysql:

# /sbin/service mysqld start

Now we log in with mysql root:

# mysql -uroot -p

Once logged in, type the following:

GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY ‘newpass’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit

We almost finished. Open file /usr/local/directadmin/conf/mysql.conf and set the correct password.

Enjoy!