Rumah  >  Artikel  >  pangkalan data  >  mysql启动提示 access denied for user root@localhost(using pa

mysql启动提示 access denied for user root@localhost(using pa

WBOY
WBOYasal
2016-06-07 17:52:1114750semak imbas

本文章来介绍关于mysql启动提示 access denied for user root@localhost(using password:YES) 解决办法总结,有需要的朋友可参考本文章。

关键是看:Access denied for user 'root'@'localhost' (using password: YES)'

从错误中可以看出你的权限是对localhost的访问没有放开。
于是你可以使用如下命令来放开权限:

解决办法

1. 管理员登陆系统,停止mysql服务或者结束mysqld-nt进程;

2. 进入命令行,来到mysql的安装目录.假设安装目录为 d:mysql , CMD进入命令行;

3. 运行 D:Program FilesMySQLMySQL Server 5.5binmysqld-nt --skip-grant-tables启动mysql,关闭权限的检查;

4. 运行 D:Program FilesMySQLMySQL Server 5.5binmysqladmin -u root flush-privileges password "newpassword" 重设root密码;

5. 重新启动mysql服务;

命令方式解决

方法一:

 代码如下 复制代码

# /data/mysql/bin/mysqladmin -u -p
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password:

mysql>

解决方法二

首先计入到mysql的客户端命令行。

然后

 代码如下 复制代码

grant all privileges on *.* to 'root'@'localhost' identified by '你的密码' with grant option;

flush privileges;

执行完这两条命令之后就可以了

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn