MySQL 重置root账户密码方法:
1、mysqladmin
[root@localhost ~]# mysqladmin -uroot -p "oldpasswd" password "newpasswd"
2、set password
MariaDB [(none)]> set password for root@localhost=password("newpasswd");
Query OK, 0 rows affected (0.00 sec)
3、update set
MariaDB [(none)]> update mysql.user set password=password("newpasswd") where user="root" and host="localhost";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
查看mysql操作记录
cat /root/.mysql_history