免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1270 | 回复: 0
打印 上一主题 下一主题

mysql忘了root密码 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-11-09 14:33 |只看该作者 |倒序浏览
killall mysqld
safe_mysqld --skip-grant-tables &
mysql
然后重新设置口令
[root@game snmp]# service mysqld stop
停止
MySQL:           
                                   
[  确定  ]
[root@game snmp]# service mysqld stop
[root@game snmp]# safe_mysqld --skip-grant-tables &
[1] 32460
[root@game snmp]# Starting mysqld daemon with databases from /var/lib/mysql
 
[root@game snmp]# mysql
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.23.58
 
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
 
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
mysql> UPDATE user SET password=password('mysql!@#123test') WHERE user='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
 
mysql> exit
Bye
[root@game snmp]# service mysqld stop
停止 MySQL: 051109 14:35:56  mysqld ended
 
                                                          
[  确定  ]
[1]+ 
Done                   
safe_mysqld --skip-grant-tables
[root@game snmp]# service mysqld start
启动
MySQL:           
                                   
[  确定  ]
[root@game snmp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.23.58
 
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
 
mysql> show databases;
+----------+
| Database |
+----------+
| mysql    |
| test     |
| vpopmail |
+----------+
3 rows in set (0.00 sec)
 
mysql>
 

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/6797/showart_56022.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP