MYSQL Login Error: mysqladmin: connect to server at ‘localhost’ failed
1.mysql登录错误
mysqladmin: connect to server at ‘localhost’ failed error: ‘Access denied for user ‘root’@’localhost’ (using password: NO)’
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
Unable to change password
Take service mysqld stop with Type mysql -uroot -p and enter Enter the original password > use mysql; > update user set password=PASSWORD("long.com") where user="root"; > change password to long.com > flush privileges; #update privileges > quit quit service mysqld restart mysql -uroot -p new password enter
Second, forget the login password of local root
Solution process:
1. Edit/etc/my.cnf
Add a line in the [mysqld] configuration section
skip-grant-tables
2. Restart MySQL after saving
[root@web02 etc]# service mysqld restart
Shutting down MySQL. [ OK ]
Starting MySQL. [ OK ]
3. Log in to the database and reset the root password
[root@web02 ~]# mysql -uroot -p mysql
Enter password:
Enter directly
Execute the following statement
mysql> update user set password=password("mysql") where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
If you execute the last one, the error is as follows:
mysql> update user set password=password("123") where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
#The reason for the error is that the password field is no longer available in the mysql database under version 5.7, and the password field has been changed to authentication_string
Then use:
mysql> update mysql.user set authentication_string=password('123') where user='root';
Query OK, 1 row affected, 1 warning (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
4. Delete the “skip grant tables” line added in the/etc/my.cnf file and restart mysql
You can log in normally with the new password
Similar Posts:
- [Solved] MYSQL ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘mysql’
- [Solved] MYSQL8 Error: ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- [Solved] Error 1054 (42s22) unknown column ‘password’ in ‘field list’ when updating the password of mysql5.7 or above
- ERROR 1044 (42000): Access denied for user ‘root’@’localhost’
- [Solved] MYSQL8.0 Error: the user specified as a definer (‘root’@’%’) does not exist
- mysql ERROR 1044 (42000): Access denied for user ‘
- ERROR 1820 (HY000): Unknown error 1820 [How to Solve]
- Mysqldump backup problems got error: 1045, error 1045 (28000), got error: 1449
- Solve the problem of unknown column ‘password’ in ‘field list’ in MySQL
- Solution to the error of MySQL: unrecognized service (CentOS)