MYSQL login error: mysqladmin: connect to server at’localhost’ failed

1. Mysql login error

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: