使用 show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
,mysql> use mysql
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
查看 /var/lib/mysql
[root@ft mysql]# ll
婊绋?36876
-rw-rw----. 1 mysql mysql 27262976 12?20 11:58 ibdata1
-rw-rw----. 1 mysql mysql 5242880 12?20 11:58 ib_logfile0
-rw-rw----. 1 mysql mysql 5242880 12?20 11:58 ib_logfile1
drwx------. 2 mysql mysql 4096 12?20 11:41 mysql
srwxrwxrwx. 1 mysql mysql 0 12?20 11:41 mysql.sock
drwx------. 2 mysql mysql 4096 12?20 11:41 test
把/var/lib/mysql的目录全部删除干净,然后再重新安装即可。
rm -rf /var/lib/mysql
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)