本文共 1387 字,大约阅读时间需要 4 分钟。
一段时间没用,又忘记了我的mysql密码了,怎样去重置密码呢?
先mark下以防下次又忘记了其实感觉mysql的数据库的加载和oracle的加载有点相似。。。ok,五步,开始!
/etc/init.d/mysql stop
输出 Stopping MySQL database server: mysqld.
mysqld_safe --skip-grant-tables &
输出
Starting mysqld daemon with databases from /var/lib/mysqlmysqld_safe
mysql -u root
输出显示
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>
mysql> use mysql;mysql> update user set password=PASSWORD("你的密码") where User='root';mysql> flush privileges;mysql> quit
/etc/init.d/mysql stop
Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pidmysqld_safe[6186]: ended[1]+ Done mysqld_safe --skip-grant-tables</pre>
/etc/init.d/mysql start mysql -u root -p
输入这条命令按enter键后再输入密码,就能进去数据库啦!
reference:
转载于:https://blog.51cto.com/11834557/2309880