第一步,停止运行mysql: systemctl stop mariadb.service
第二步,使用“ -skip-grant-tables”参数重新启动mysql: mysqld_safe --skip-grant-tables &
第三步,用帐号登录mysql(NOPASSWD): mysql -u root
第四步,改变用户数据库: MariaDB [(none)]> use mysql
第五步,修改密码: MariaDB [mysql]> update user set password=password('Skills39') where user='root';
6
第六步,刷新权限表: MariaDB [mysql]> flush privileges; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that aDB server version for the right syntax to use near 'previleges' at line 1 MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.01 sec)
7
第七步,推出:quit
第八步,重启mariadb服务:systemctl restart mariadb.service
第九步,登陆mariadb查看是否生效:mysql -u root -p