Cart

    Sorry, we could not find any results for your search querry.

    DirectAdmin ERROR 1045 (28000): Access denied for user 'root'@'localhost'

    If you try to start an SQL shell as root user on a DirectAdmin VPS via SSH by using the command:

    mysql -u root -p

    You may get the error message:

    ERROR 1045 (28000): Access denied for user 'root'@'localhost'

    This error message is caused by the fact that on a DirectAdmin server, the administrative SQL user is set in /usr/local/directadmin/conf/mysql.conf by default.

    You can solve this by running the following commands sequentially as a root user or with sudo via SSH:

    mysql --user=`grep "^user=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2` --password=`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2`
        use mysql;
        UPDATE user SET password=PASSWORD('Password') WHERE user='root';
        FLUSH PRIVILEGES;
        quit

    Replace 'Password' with the password that you want to use for the root SQL user.


     

    Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

     

    Need help?

    Receive personal support from our supporters

    Contact us