MySQL root password recovery in DirectAdmin

Before changing MySQL root password you may try to recover default installation password. DirectAdmin MySQL root password is set within the installation process and written down to setup.txt. If you didn’t change this password you can find the default one in the setup.txt, use the command below to see the contents of /usr/local/directadmin/scripts/setup.txt: your password is stored in the line starting with “mysql=” To see the contents of this file from a terminal, type:
less /usr/local/directadmin/scripts/setup.txt

If you want to access mysql from ssh or console directly without typing password, create a file in /root/ dir called .my.cnf:
touch /root/.my.cnf

and edit this file with the vi editor:
vi /root/.my.cnf

Add the lines below:
[client]
user=root
password=XXXXXX

Fill the password with the pass you got from setup.txt, save the file with SHIFT+ZZ or :wq and exit. After this step just write mysql to enter MySQL console directly without password.
[root@test ~]# mysql
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 169833
 Server version: 5.0.77-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Adding New IP to DirectAdmin From Different Subnet and Gateway

Earlier I’ve posted an article describing how to add multiple ip addresses on a single...

PHP-SOAP Installation on DirectAdmin

People using Direct Admin usually do the mistake to install anything new by using the yum...

Directadmin : Problem Receiving Emails – The “Unknown User” Issue

If you get a 550 error as a reply when you email a user with directadmin, saying Remote host...

How to Reset DirectAdmin “admin” Password

DirectAdmin determines the admin password during installation and saves these passwords into the...

Step III: DirectAdmin post installation tasks

There are some important processes after successfully installation of DirectAdmin and if you miss...