centos下MariaDB重置密码和ubuntu下mysql 有很大不同.
1 Check the version of our MariaDB Server
mysql --version
mysql Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1
2 stop MariaDB service
systemctl stop mariadb.service
3 start MariaDB database in safe mode without loading the privileges tables
mysqld_safe --skip-grant-tables --skip-networking &
4 使用mysql -u root登入
5 set the new password for root user, we have to load the privileges tables into memory
FLUSH PRIVILEGES;
6 set a new password for MariaDB root user
ALTER USER 'root'@'localhost' IDENTIFIED BY '111111';
返回
Query OK, 0 rows affected (0.001 sec)
7 Reload the privileges tables again
FLUSH PRIVILEGES;
New password for MariaDB root user has been set
阅读(927) | 评论(0) | 转发(0) |