您的位置:首页 > 博客中心 > 数据库 >

MySQL问题

时间:2022-03-15 15:48

# mysql -u root mysql
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)

 

解决:[root@ZHT02 ~]#  /etc/init.d/mysql stop
Shutting down MySQL.. SUCCESS!
[root@ZHT02 ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 9707
[root@ZHT02 ~]# 160518 13:37:27 mysqld_safe Logging to ‘/var/lib/mysql/ZHT02.err‘.
160518 13:37:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
^C
[root@ZHT02 ~]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.22-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

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> UPDATE user SET Password=PASSWORD(‘1234‘) 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)

mysql> quit
Bye

本类排行

今日推荐

热门手游