Thursday, April 25, 2013

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

I was trying to install the stocked MySQL 5.6.11 from mysql.com instead of using the default shipped MySQL with RHEL6.

Post-installation, the temporary password gets stored in /root/.mysql_secret. You login to MySQL Database using:

mysql -u root -pC7hCdlti
Then connect to database:

mysql> connect mysql;
Connection id:    2
Current database: mysql

If you try any further operation, you'll see an error:


mysql> select * from user;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
To get past this, set the password for root like this:

mysql>  SET PASSWORD for root@'localhost' = PASSWORD('secret');
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 Now try logging in using the newly set password and you're good to go.



Labels: , ,