Support Center > Knowledgebase > Web Host Manager > Database Information > Mysql gives error of access denied for root@localhost ?
Mysql gives error of access denied for root@localhost ?
- Make sure root pass is in /root/.my.cnf.
This is usually the first root pass the box was given once cpanel is installed. If it still does not work, you will need to reset the mysqld root pass. To do so:
- Stop the mysqld.
- Usually /etc/rc.d/init.d/mysql stop
- Stop chkservd to keep it from interfering with mysqld
- /etc/rc.d/init.d/chkservd stop
- Start mysqld without the grant tables
- mysqld --skip-grant-tables -u mysql &
- Change the pass.
- mysql -u root mysql UPDATE user SET Password=PASSWORD('new_password') WHERE user='root'; FLUSH PRIVILEGES;
Now you just killall -9 mysqld and start it up normally with it's safe_mysqld script.
Also Read