Access denied for user 'root'@'localhost' (using password: YES)
2016-02-03 10:53
447 查看
提示:access denied for user 'root'@'localhost' using password yes
系统:windows7 64
1. 管理员登陆系统,停止 MySQL 服务或者结束 MySQL 进程。
2. 启动 WINDOWS 的命令行窗口(即通常的 DOS 窗口),切换到你的 “MySQL\bin” 目录下。
例如我的是 “D:\SERVER\MySQL\bin”,然后执行下面的粗体的命令:
(注意你的 “my-default.ini” 位置)
Microsoft Windows7 [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\MMC>d:
D:\>cd D:\SERVER\MySQL\bin
D:\SERVER\MySQL\bin>mysqld --defaults-file="D:\SERVER\MySQL5122\my-default.ini" --console --skip-grant-tables
090801 4:43:54 InnoDB: Started; log sequence number 0 585546
090801 4:43:54 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
090801 4:43:54 [Note] mysqld: ready for connections.
Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server (GPL)
_
只要出现下面信息,就说明 MySQL 已经起来了。
Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server (GPL)
3. 不关闭此命令行窗口,重新打开一个命令行窗口,同样切到 “mysql\bin” 目录下,然后执行下面的粗体的命令:
C:\Documents and Settings\MMC>d:
D:\>cd D:\SERVER\MySQL\bin
D:\SERVER\MySQL\bin>mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.22-rc-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
到这步,我想任何一个使用 MySQL 的人都知道后面要做什么了!(^a^)
mysql>
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
4. 好了到此步,可以关闭第一个 DOS 窗口了。打开系统服务控制窗口(控制面板--管理工具--服务),启动 MySQL 服务。
5. 在剩下的第二个 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.
mysql> quit
Bye
至此,系统恢复 ROOT 用户管理权限完成。
系统:windows7 64
1. 管理员登陆系统,停止 MySQL 服务或者结束 MySQL 进程。
2. 启动 WINDOWS 的命令行窗口(即通常的 DOS 窗口),切换到你的 “MySQL\bin” 目录下。
例如我的是 “D:\SERVER\MySQL\bin”,然后执行下面的粗体的命令:
(注意你的 “my-default.ini” 位置)
Microsoft Windows7 [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\MMC>d:
D:\>cd D:\SERVER\MySQL\bin
D:\SERVER\MySQL\bin>mysqld --defaults-file="D:\SERVER\MySQL5122\my-default.ini" --console --skip-grant-tables
090801 4:43:54 InnoDB: Started; log sequence number 0 585546
090801 4:43:54 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
090801 4:43:54 [Note] mysqld: ready for connections.
Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server (GPL)
_
只要出现下面信息,就说明 MySQL 已经起来了。
Version: '5.1.22-rc-community' socket: '' port: 3306 MySQL Community Server (GPL)
3. 不关闭此命令行窗口,重新打开一个命令行窗口,同样切到 “mysql\bin” 目录下,然后执行下面的粗体的命令:
C:\Documents and Settings\MMC>d:
D:\>cd D:\SERVER\MySQL\bin
D:\SERVER\MySQL\bin>mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.22-rc-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
到这步,我想任何一个使用 MySQL 的人都知道后面要做什么了!(^a^)
mysql>
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
4. 好了到此步,可以关闭第一个 DOS 窗口了。打开系统服务控制窗口(控制面板--管理工具--服务),启动 MySQL 服务。
5. 在剩下的第二个 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.
mysql> quit
Bye
至此,系统恢复 ROOT 用户管理权限完成。
相关文章推荐
- worldpress或zblog安装时建立数据库连接时出错
- jQuery $.each用法
- afnetworking中,规范json格式的代码---这样打印出来errormessage就非常的方便了,呵呵呵呵
- javascript鼠标右键菜单自定义效果
- 内存不足,无法运行Microsoft Excel 请关闭其他相应程序再试怎么办
- 234. Palindrome Linked List
- 怎样把LoRa终端功耗降到极致
- Redis内存调优一例
- javascript中关于字符串替换 replace() 方法的使用(咋个办呢 zgbn)
- EditText:带清空功能的EditText控件
- EventBus的其他常用函数
- EventBus的其他常用函数
- Python多线程
- linux下安装mysql的详细教程
- 自定义ViewGroup--标题条加内容页的布局方式
- 反射API
- table数据如何通过ajax方式加载?
- ionic build android Could not resolve com.android.tools.build:gradle:1.5.0
- 安卓开发中的各种进度条样式
- afnetworking网络请求,ios中的网络请求示例代码