ERROR 1820 (HY000) occurs during mysql installation: You must set password before executing this statement solves the problem that the newly installed mysql always has an ERROR prompt when it enters the mysql tool: # mysql-u root-pEnter password: ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) or # mysql-u root-p password 'newpassword' Enter password: mysqladmin: connect to server at 'localhost' failederror: 'Access denied for user' root' @ 'localhost' (using Password: YES) 'Now the solution is finally found. It was originally prepared to be reinstalled. It is no longer necessary. The method is simple, as follows: #/etc/init. d/mysql stop # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking & # mysql-u root mysqlmysql> UPDATE user SET Password = PASSWORD ('newpassword ') where USER = 'root' and host = 'root' or host = 'localhost'; // you can change all empty USER passwords to non-empty passwords. Mysql> flush privileges; mysql> quit #/etc/init. d/mysqld restart # mysql-uroot-pEnter password: <enter the new password newpassword> MySql5.6, and an error is returned: you must set password before executing this statement solves mysql> set password = PASSWORD ('000000'); Query OK, 0 rows affected (123456 sec) mysql> create database roger; Query OK, 1 row affected (0.00 sec), that is, use mysql> set password = PASSWORD ('000000'); reset the PASSWORD again!