首先停止MariaDB服务:
systemctl stop mariadb
以跳过权限方式启动MariaDB:
mysqld_safe --user=mysql --skip-grant-tables&
以root登录mysql:
mysql -uroot
进入mysql数据库:
use mysql;
修改root用户密码:
UPDATE user SET password=PASSWORD('123456') WHERE user='root';
刷新权限表:
flush privileges;
退出mariadb:
exit
重启mariadb服务:
systemctl start mariadb