当前位置:win7 > win7教程 >

win7系统连接Mysql提示Access denied for user 'root'@'localhost'的解决方法

时间:2021-08-27 08:48:03来源: www.ghostwin8.com 作者:win7sql 浏览次数:

  我们在使用win7系统的过程中,经常需要对win7系统连接Mysql提示Access denied for user 'root'@'localhost'进行设置。很多对电脑不太熟悉的小伙伴不知道win7系统连接Mysql提示Access denied for user 'root'@'localhost'到底该如何设置?其实win7系统连接Mysql提示Access denied for user 'root'@'localhost'的设置方法非常简单,只需要1、点击“开始”->“程序”->"运行",以管理员的身份运行; 2、在命令行中输入  C:\Documents and Settings\MMC>e:,e盘为Mysql服务所在的盘符;就可以了。下面小编就给大家介绍一下win7系统连接Mysql提示Access denied for user 'root'@'localhost'具体的设置方法:

Win7系统连接Mysql提示Access denied for user 'root'@'localhost'怎么办

  1、点击“开始”->“程序”->"运行",以管理员的身份运行;

  2、在命令行中输入  C:\Documents and Settings\MMC>e:,e盘为Mysql服务所在的盘符;

  3、打开Mysql.bin目录,在命令行输入E:\>cd E:\mysql-5.5.49-win32\mysql-5.5.49-win32\bin;

  4、接着在命令行中输入 E:\SERVER\MySQL5122\bin>mysqld --defaults-file=" E:\mysql-5.5.49-win32\mysql-5.5.49-win32\ my.ini" --console --skip-grant-tables,只要出现下面信息,就说明 MySQL 已经起来了。

Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server 

  5、紧接着,不关闭此命令行窗口,重新打开一个命令行窗口,同样切到 “mysql\bin”目录下,然后执行下面的命令:

C:\Documents and Settings\MMC>e:

E:\>cd E:\mysql-5.5.49-win32\mysql-5.5.49-win32\bin

D:\>cd D:\SERVER\MySQL5122\bin E:\SERVER\MySQL5122\bin>mysql -u root mysql

出现Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.1.22-rc-community MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>

  6、接着在命令行中输入粗体命令:

mysql>UPDATE user SET Password=PASSWORD('mynewpass') where USER='root';

Query OK, 2 rows affected (0.05 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.02 sec) mysql> quit Bye

  7、好了到此步,可以关闭第一个 DOS 窗口了。打开系统服务控制窗口(控制面板--管理工具--服务),启动 MySQL 服务。

  8、在剩下的第二个 DOS 窗口中,用新的 ROOT 密码连接 MySQL。

D:\SERVER\MySQL5122\bin>mysql -u root -p Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.22-rc-community MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  9、mysql> quit Bye 至此,系统恢复 ROOT 用户管理权限完成。

  以上就是关于Win7系统连接Mysql提示Access denied for user 'root'@'localhost'怎么办的全部内容,有碰到这样情况的用户们可以采取上面的方法来解决吧,希望更可以帮助到大家。

Tags: sql


TAGS

热门教程



Copyright @ 2021 xp系统下载官网 ghostwin8.com 版权所有

本站发布的系统与软件都由网友上传仅为个人学习测试使用,不得用于任何商业用途,否则后果自负,请支持购买微软正版软件!

如有侵犯您的版权,请联系我们会第一时间处理!