mysql executes show databases, there is no mysql database

I checked related cases on the Internet and found the

solution related to the permission table mysql.user table:
close the database
service mysqld stop

to start mysql
mysqld_safe --defaults-file=/etc/my.cnf --skip -grant-tables &

delete the record with host name 'localhost' in mysql.user table
mysql> use mysql
mysql> delete from user where host='localhost';
Query OK, 7 rows affected (0.00 sec)

mysql> INSERT INTO ` user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y' ,'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',' Y','Y','Y','Y','Y','Y', 'Y', '','','','',0,0,0,0);
Query OK, 1 row affected (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

After restarting the database again, normal
service mysqld restart 

mysqld_safe - -defaults-file=/etc/my.cnf &

Change root password
mysqladmin -u root -proot password 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325312139&siteId=291194637