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.

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: