PHP学会网 php培训网 PHP暑期培训 PHP寒假培训 PHP假期培训 » 数据库应用 » mysql恢复root密码
本页主题: mysql恢复root密码 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

游子云



该用户目前不在线
级别: 管理员
精华: 3
发帖: 237
威望: 196 点
金钱: 1974 PYMB
贡献值: 0 点
在线时间:33(小时)
注册时间:2005-10-27
最后登录:2008-05-13

mysql恢复root密码

本帖被 phpwhy 设置为精华(2007-06-13)
To reset a forgotten mysql root password you have to start MySQL by bypassing all privileges and reset the root password. It is highly suggest you do this in single user mode, since it is still possible for every user to access the mysql.sock, if you haven't changed privileges. What you should do:
Copy code
/etc/init.d/mysql stop
/usr/bin/mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
use mysql;
UPDATE user SET Password=PASSWORD("your password here") WHERE User="root";
exit
# kill all the mysql processes
/etc/init.d/mysql stop
# Start MySQL again
/etc/init.d/mysql start

至于停mysql的方法有很多,我是查出进程直接kill:)

ps -ef|grep mysql

kill -9 进程号

还可以

/bin/kill `cat /var/run/mysqld/mysqld.pid`  2>; /dev/null


附一条修复mysql数据库表的命令

/usr/local/bin/mysqlcheck -uroot -p  -r [database name]
PHP培训,网站建设咨询
联系电话: 0571-85980046 ,0571-86704910
联系人:何老师
qq:310172
地址:杭州下沙4号路物美西子阳光星城1座501室
顶端 Posted: 2007-05-19 10:40 | [楼 主]
PHP学会网 php培训网 PHP暑期培训 PHP寒假培训 PHP假期培训 » 数据库应用

现在时间:05-17 12:23 Copyright © 2006 phpwhy.com 版权所有
浙ICP备05060669号 我要啦免费统计

点击这里给我发消息关于我们 - 合作联系