Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 17:52:11
Original
14747 people have browsed it

本文章来介绍关于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;

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!