Jun 24th, 2009
MySQL: Access denied for user
MySQL: Access denied for user
MySQL Error : Error connecting to MySQL: Access denied for user: ‘root@localhost’ (Using password: YES)
This is mainly caused due to the fact that the user root does not have enough privileges to access the mysql databases or the password set for the user root to connect mysql was changed.
1. Start mysql using mysqld_safe
#mysqld_safe –skip-grant-tables &
Note:
mysqld_safe is used to start mysql server by disabling certain feature that restrict a user to access mysql. The option –skip-grant-tables is used to neglect the permission grant to different users of mysql.
2. Enter mysql prompt by just typing “mysql” and do the following
>FLUSH PRIVILEGES;
>\q
3. Kill all mysql processes and start mysqld
#killall -9 mysqld
#/usr/local/etc/rc.d/mysqld start