mysql密码忘记了如何解决
今天在登录mysql时输入密码登不上去
在/etc/my.cnf添加配置
[root@pro ~]# vim /etc/my.cnf
skip-grant-tables
[root@pro ~]# systemctl start mysqld
登录之后修改密码
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
mysql> UPDATE user SET authentication_string=PASSWORD('123456') WHERE User='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye