您的位置:首页 > 其它

ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: NO)

2016-01-14 20:02 519 查看
登陆mysql出现如下错误
[root@NeoKylin-CNVL/]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: NO)

解决办法:
[root@NeoKylin-CNVL/]# /etc/init.d/mysql stop
[root@NeoKylin-CNVL/]#mysqld_safe --user=mysql --skip-grant-tables--skip-networking &
[2] 8196
[root@NeoKylin-CNVL/]# 160114 19:30:36 mysqld_safe Logging to
'/var/lib/mysql/NeoKylin-CNVL.cs1cloud.internal.err'.
16011419:30:36 mysqld_safe A mysqld process already exists

mysql -u root mysql
Readingtable information for completion of table and column names
You canturn off this feature to get a quicker startup with -A
Welcometo the MySQL monitor. Commands end with; or \g.
YourMySQL connection id is 2
Serverversion: 5.6.25 MySQL Community Server (GPL)
Copyright(c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracleis 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 SETPassword=PASSWORD('123') where USER='root';
QueryOK, 4 rows affected (0.00 sec)
Rowsmatched: 4 Changed: 4 Warnings: 0

mysql> FLUSH PRIVILEGES;
QueryOK, 0 rows affected (0.00 sec)

mysql> quit
重新启动mysql
[root@NeoKylin-CNVL/]# /etc/init.d/mysqld restart
[root@NeoKylin-CNVL/]#mysql -uroot -p
Enterpassword:

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