Friday, February 29, 2008

/usr/local/cpanel/Cpanel/Mysql.pm line 42 ERROR 1045

If you are facing mysql error on all cpanel/WHM pages

ERROR :

DBI connect(mysql:localhost,root,...) failed: Access denied for user: root@localhost (Using password: YES) at /usr/local/cpanel/Cpanel/Mysql.pm line 42 ERROR 1045: Access denied for user: root@localhost (Using password: YES) 0 / unlimited

Solution :

1. Edit the file /root/.my.cnf
pico /root/.my.cnf
2. Use the mysql root password in the file and reset the mysql password to that password in .my.cnf file.

/etc/init.d/mysqld stop
safe_mysqld --skip-grant-tables
mysql
USE mysql
UPDATE user
SET password=password("Password in .my.cnf file")
WHERE user="root";
flush privileges;
exit;
killall mysqld
/etc/init.d/mysql start
=====================================================================================
One more addition to this....

Log into the shell and then execute the following command:

$mysqladmin flush-hosts

I would say first run this command and then if it doesn't work, try increasing the limit in my.cnf file or the method above.

Please let me know if I am incorrect.
=====================================================================================

No comments: