首页 > Sql语句 > Mysql忘记密码之后的处理办法

Mysql忘记密码之后的处理办法

-bash-4.1# service mysqld stop
Stopping mysqld: [ OK ]

-bash-4.1# mysqld_safe –user=mysql –skip-grant-tables –skip-networking
150110 00:30:41 mysqld_safe Logging to ‘/var/log/mysqld.log’.
150110 00:30:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150110 00:33:42 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
-bash-4.1# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> use mysql
Database changed

mysql> UPDATE user SET Password=PASSWORD(‘需要设置的密码’) where USER=’root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye

-bash-4.1# service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]

-bash-4.1# mysql -uroot -p

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.00 sec)

mysql>

-bash-4.1# service mysqld stop Stopping mysqld: [ OK ] […]

  1. 还没有评论
评论提交中, 请稍候...

留言

(Spamcheck Enabled)

Trackbacks & Pingbacks ( 0 )
  1. 还没有 trackbacks