I recently used MySQL and upgraded it to the latest version through emerge. As a result, I encountered a small problem and posted the solution process here. I hope it will be helpful for children's shoes with similar problems.
1./etc/init. d/MySQL
Start starts MySQL and cannot be started. -- prompt: * MySQL datadir is empty or
Invalid
* Please check your my. CNF:/etc/MySQL/My. CNF --
Possible Cause Analysis: from the default MySQL installation in portage, the configuration file is 32-bit, And the datadir location is incorrect under 64-bit. 2. Open/etc.
/MySQL/My. CNF find and modify datadir: datadir =/usr/lib64/MySQL
# I changed it to/usr/share/MySQL. Actually, it cannot be -_-!!
3. Start MySQL again -- prompt: * MySQL not started (0) is started in "safe mode" of MySQL.
Mysql_secure_installation command -- prompt: * error 2002 (hy000): Can't
Connect to local MySQL server through socket
'/Var/run/mysqld. Sock' (2) -- possible cause analysis: permissions under the/var/run/mysqld directory
If there is a problem with the settings, change the socket value to/tmp/MySQL. socket or chmod 777.
/Var/run/mysqld (I have tried it and it works)
4. Modify the socket configuration in my. CNF to search for and modify: Socket =/tmp/mysqld. Sock
5. Start MySQL again ..