user版本可以root不,system内置root

叶卓君

  近日有不少win7旗舰版系统用户到本站反馈说遇到这样一个问题,就是在连接Mysql的时候,提示Accessdeniedforuserroot@localhost,该怎么解决这样的问题呢,现在随小编一起来看看Win7系统连接Mysql提示Accessdeniedforuserroot@localhost的具体解决方法吧。

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

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

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

  4、接着在命令行中输入 E:\SERVER\MySQL5122\binmysqld --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\MMCe:

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

D:\cd D:\SERVER\MySQL5122\bin E:\SERVER\MySQL5122\binmysql -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、接着在命令行中输入粗体命令:

mysqlUPDATE user SET Password=PASSWORD(mynewpass) where USER=root;

Query OK, 2 rows affected (0.05 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysqlFLUSH PRIVILEGES; Query OK, 0 rows affected (0.02 sec) mysqlquit Bye

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

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

D:\SERVER\MySQL5122\binmysql -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、mysqlquit Bye 至此,系统恢复 ROOT 用户管理权限完成。

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