mysql--重置密码
mysql> use mysql;mysql> update user set password=password('123') where user='root' and host='localhost';
##假如是mysql5.7之后的就password字段改成了authentication_string:
mysql> update user set authentication_string=password('redhat') where user='root'and host='localhost';
mysql5.7以上版本--> UPDATE user SET authentication_string=PASSWORD("root") WHERE User="root";
mysql> flush privileges;
mysql> ALTER user 'root'@'localhost' identified by 'redhat';
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
页:
[1]