您的位置:首页 > 数据库 > MySQL

Mysql 问题篇 --- Access denied for ERROR 1045 (28000)

2015-07-24 17:58 766 查看
issue: Access denied for ERROR 1045 (28000)

[root@jt30dmz001tc001 ~]# mysql -u root -ppass
Access denied for ERROR 1045 (28000):user 'root'@'localhost' (using password: YES)

#way 1
#step 1: Start the MySQL server instance or daemon with the --skip-grant-tables option (security setting).

mysqld --skip-grant-tables

#step 2:
$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;

#step 3:
$ /etc/init.d/mysql restart

####way 2

[root@jt30dmz001tc001 ~]# mysql -u root -ppass -h 0.0.0.100
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.38 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> select host, user, password from user;
+------------------------------+------+-------------------------------------------+
| host                         | user | password                                  |
+------------------------------+------+-------------------------------------------+
| %                            | root | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| jt30dmz001tc001.qa.webex.com | root |                                           |
| 127.0.0.1                    | root |                                           |
| ::1                          | root |                                           |
| localhost                    | root |                                           |
| jt30dmz001tc001.qa.webex.com |      |                                           |
+------------------------------+------+-------------------------------------------+
6 rows in set (0.00 sec)

mysql> update user set password = PASSWORD('pass') where user = 'root' and host = 'localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select host, user, password from user;
+------------------------------+------+-------------------------------------------+
| host                         | user | password                                  |
+------------------------------+------+-------------------------------------------+
| %                            | root | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| jt30dmz001tc001.qa.webex.com | root |                                           |
| 127.0.0.1                    | root |                                           |
| ::1                          | root |                                           |
| localhost                    | root | *196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7 |
| jt30dmz001tc001.qa.webex.com |      |                                           |
+------------------------------+------+-------------------------------------------+
6 rows in set (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

[root@jt30dmz001tc001 ~]# mysql -u root -ppass
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.5.38 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql login