This problem is due to the fact that the database table is not installed in the data directory
Workaround:
Vi/etc/my.cnf
Modify the correct datadir= "xxxxx" to
Then service mysqld start
Service MySQL Start
After normal startup, you will/var/lib/mysql the following generated Mysql.sock file,
Then also reported: ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock '
You can specify the Mysql.sock path:
Mysql-u root-p-s/var/lib/mysql/mysql.sock
There are sometimes problems with your directory permissions:
Remember to assign permissions: Chown-r mysql:mysql/usr/local/mysql
The above is transferred from http://blog.csdn.net/ec06cumt/article/details/50778240
I checked the data file without the database file, which is the "database table is not installed because of the data directory."
But my problem is that the database on the server was hacked and all the data was erased (including MySQL's own database), so my solution: 1. Copy a system data file in the past; 2. Reload MySQL.
So I copied my local mysql,performance_schema,test three folder to the server's data folder to restart my Phpstudy (my is an integrated environment). OK Problem Solving
[ERROR] Fatal Error:can ' t open and Lock Privilege tables:table ' mysql.user ' doesn ' t exist