MariaDB忘记密码

就是按照找到的教程 但是在my.cnf 中找不到mysql 那就看看它包含的目录里面有一个server.cnf 在这个文件中找到了mysql的部分那就添加一下skip-grant-tables到里面
然后

重启MariaDB
进入到mysql

mysql

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.13-MariaDB Source distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 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

MariaDB [mysql]> UPDATE user SET Password = password('123456') WHERE User = 'root';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> quit
这样再到前面的目录里面删除之前加进去的东西就好了
继续重启MariaDB服务

posted @ 2021-03-11 19:45  simp00  阅读(108)  评论(0编辑  收藏  举报