mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@’localhost’ (using password:
use service mysqld stop
mysqld_safe — skip-gran-tables &
enter mysql-uroot-p enter
> use mysql;
> update user set password=PASSWORD(“newpass”)where user=”root”;
change password to newpassord
> flush privileges; Update permission
> Quit out
service mysqld restart
mysql – uroot – p a new password to enter
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2, forget the local root login password
solving process:
1, edit /etc/my.cnf
to [mysqld] configuration part to add a line
skate-grant-tables
; 2. Restart mysql
[root@localhost etc]# service mysqld restart
Shutting down mysql. [OK
Starting MySQL. [OK]
Welcome to
[root@localhost ~]# mysql-uroot-p MySQL
Enter password:
Enter
Welcome to
Commands end with the MySQL Monitor. or \g.
Your MySQL connection id is 1
Server version: 5.1.47-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help; ‘ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show databases;
+ — — — — — — — — — — — — — — — — — — — — +
| Database |
+ — — — — — — — — — — — — — — — — — — — — +
| information_schema |
| mysql |
| test |
+ — — — — — — — — — — — — — — — — — — — — +
3 rows in the set
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
mysql> flush privileges;
Query OK, 0 rows affected (0.00 SEC)
4, delete the added “skip-gran-tables” row from /etc/my.cnf file, and restart mysql;
can log in normally with the new password;
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Skip-grant-tables, a very useful mysql startup parameter, is described. As the name implies, you don’t start The grant-tables authorization table when mysql starts. What’s the use?Of course, it is useful to forget the administrator password. Operation method:
1, kill the original mysql:
rcmysqld stop
or:
service mysqld stop
or:
kill TERM mysqld
2. Start mysql with command line parameters:
/usr/bin/mysqld_safe – skip – grant – tables & amp;
3. Modify the administrator password:
use mysql;
update user set password=password(‘yournewpasswordhere’) where user=’root’;
flush privileges;
the exit;
4. Kill mysql, restart mysql
Read More:
- mysql problem solving: mysqladmin: connect to server at’localhost’ failed
- The MySQL service suddenly hangs up with the error message can’t connect to MySQL server on ‘localhost’ (10061)
- Error 2003 (HY000): can’t connect to MySQL server on ‘localhost’ (10061)
- ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- MySQL: if the remote connection using navicatip fails, prompt “is not allowed to connect to this MySQL server”
- JDBC connect to Sql Server to connect to the database–The TCP/IP connection to the host localhost, port 1433 has failed
- It can’t connect to local MySQL server through socket ‘/ tmp/ mysql.sock ‘(2) “;
- How to Fix failed to Connect to MySQL at localhost:3306 with user root
- The server just without updating PID file and can’t connect to local MySQL server through socket are solved
- Can’t connect to MySQL server error 111
- Host is not allowed to connect to this MySQL server
- EBS R12 login error—R12.1 FRM-92050: FAILED TO CONNECT TO SERVER: /FORMS/LSERVLET
- Linux-mysql8.0 password reset problem – error 1396 (HY000): Operation alter user failed for ‘root’ @’localhost ‘
- Sqlog connect to MySQL 8.0.24 remote server, error: 2058 solution
- Navicat for MySQL error 1251 failed to connect to MySQL
- [MySQL] error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘
- Server Tomcat v7.0 server at localhost failed to start
- Cannot connect to MySQL server on “host” (113)
- MySQL error — multiple methods of failed to find valid data directory and MySQL setting password appear
- Server Tomcat v8.0 Server at localhost failed to start.