A Troupe of little vagrants of the world, leave your footprints in my words.--我的文摘本.
查看文章 |
忘记MySQL密码的更改方法{转}
2007-09-04 10:47
1、在linux中 如果 MySQL 正在运行,首先杀之: killall -TERM mysqld 启动 MySQL :/usr/bin/safe_mysqld --skip-grant-tables 就可以不需要密码就进入 MySQL 了。 然后就是 >use mysql >update user set password=password("new_pass") where user="root"; >flush privileges; 重新杀 MySQL ,用正常方法启动 MySQL 。 2、在windows中 如果mysql正在运行,不要关闭 执行: mysqld --skip-grant-tables 命令 这时如果看到屏幕没反应,表示服务已启动 在一个新窗口中运行 mysql 可以不用密码登录 update user set password=password("new_pass") where user="root"; 杀掉mysqld 的进程 附:mysql常用操作命令 mysql> show databases; mysql> create database objectdb; mysql> grant all on objectdb.* to objectuser; mysql> grant all on objectdb.* to objectuser@localhost; mysql> set password for objectuser@localhost=password(objectpassword); mysql> exit |
最近读者: