MYSQL Access denied for user 'root'@'localhost'
mysql
Solution
It was absolutely correct what you did, but I guess it's not working for one small reason.
You should use `identified by password` when you are going to grant privileges like this:
mysql> GRANT ALL PRIVILEGES ONE `*`.`*` TO 'root'@'localhost' IDENTIFIED BY PASSWORD
'*A4B6157319038724E3560894F7F932C8886EBFCF' WITH GRANT OPTION;
Problem
I did the following steps to use MySQL in Ubuntu: ``` sudo aptitude install php5-mysql mysql-server sudo service mysql stop sudo mysqld_safe --skip-grant-tables & sudo mysql -u root mysql ``` Change root password: ``` mysql> UPDATE mysql.user SET Password=PASSWORD('SecurePassword') WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> EXIT ``` Modify /etc/mysql/my.cnf: ``` [client] user=root password=SecurePassword [mysqld] ... default-time-zone = '+0:00' ``` Then: ``` sudo service mysql start mysql -u root mysql> SHOW GRANTS FOR root@localhost +--------------------------------------------------------------------------------------------------+ | Grants for root@localhost | +--------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '[here is the Securepassword]' | +-------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; ``` and I receive an error: Access denied for user 'root'@'localhost' (using password: YES)