[转载]mysql忘记密码

转自:http://huagelinux.blog.163.com/blog/static/8733708320102236620104/ [root@localhost ~]# service mysqld stop 停止 MySQL: [确定] [root@localhost ~]# mysqld_safe --skip-grant-tables & [1] 3674 #马上会出现下面这个提示,为了进入mysql,你可以用Ctrl+C结束或者重新打开一个终端 [root@localhost ~]# Starting mysqld daemon with databases from /var/lib/mysql #上面这行不是命令,而是提示 [root@localhost ~]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or /g. Your MySQL connection id is 1 Server version: 5.0.77 Source distribution 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 #密码修改为 mysqlpassword mysql> update user set password=password("mysqlpassword") where user="root"; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> exit Bye [root@localhost ~]# service mysqld restart [root@localhost ~]# 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.0.77 Source distribution Type 'help;' or '/h' for help. Type '/c' to clear the buffer. mysql>

你可能感兴趣的:(mysql,server,service,user,table,Warnings)