mysql -u root -p
ERROR 1045 (28000 ): Access denied for user 'root'@'localhost' (using password: YES )
mysql
ERROR 1045 (28000 ): Access denied for user 'root'@'localhost' (using password: NO )
阿神2017-04-17 13:14:57
Enter the password (I encountered this before and didn’t study it carefully, but entering the password seems to solve the problem
大家讲道理2017-04-17 13:14:57
You can find out this kind of problem just by Baidu.
But since I have answered it, I will explain it to you in detail.
1. Check whether the database password is set;
2. Have the password been changed since the database was started? If the password has been changed, flush privileges;
3. How many MySQLs have been installed? Log in with the absolute path: /path/to/mysql/bin/mysql -u username -p and press Enter. If you set a password, enter the password and press Enter. If you do not set a password, just press Enter to log in.