MySQL (mariadb) forgot login password, prompt as follows
[Email protected] ~]# mysql-uroot-penter password:error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)
2. Stop MySQL
[Email protected] ~]# Systemctl stop mariadb
3. Use--skip-grant-tables to connect MySQL, at this time MySQL cannot authorize operation, can reset password
[Email protected] ~]# mysqld_safe--skip-grant-tables 161103 14:52:25 mysqld_safe Logging to '/var/log/mariadb/ Mariadb.log '. 161103 14:52:25 mysqld_safe A mysqld process already exists
4. Turn on MySQL and go directly to
[[email protected] ~]# systemctl start mariadb[[email protected] ~]# Mysqlwelcome to the mariadb monitor. commands end with ; or \g.your mariadb connection id is 2server version: 5.5.50-mariadb MariaDB ServerCopyright (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 Namesyou can turn off this feature to get a quicker startup with -adatabase changedmariadb [mysql]> update user set password= Password (' 123456 ') where user= ' root '; query ok, 4 rows affected (0.00 sec) rows matched: 4 changed : 4 warnings: 0mariadb [mysql]> flush privileges -> ; query ok, 0 rows affected (0.00 sec) mariadb [mysql]> exit; Bye
5. Reset Password to 123456, test login
[Email protected] ~]# Mysql-uroot-penter password:welcome to the MariaDB Monitor. Commands End With; or \g.your MariaDB connection ID is 3Server version:5.5.50-mariadb MariaDB servercopyright (c), Oracle, Mariad B Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [(None)]>
This article is from the "Linux Sailing" blog, make sure to keep this source http://jiayimeng.blog.51cto.com/10604001/1868955
MySQL Forgot login password