System: ubuntu16.04 using apt-get command to install MySQL, error on startup:
Can ' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock '
Google a pitch, according to the online, need to modify the configuration file, the original path should be/etc/mysql/my.cnf, but there are only two lines, before it is not so ah, change do not know how to change. So try reinstalling, uninstalling MySQL:
sudo apt-get remove Mysql-server
Then delete all the MySQL folders:
Find /-name MySQL
Delete all the MySQL folders that you have searched for.
Then reinstall:
sudo Install Mysql-server
Then restart:
Service MySQL Start
Using mysql-u root login, and then the egg, still can ' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock '.
Then Google a pass, the period to the MySQL website to download the Deb package installation, but not successful, found to rely on a lot, the official website to download the compressed package inside the common client Server installation files, installation is always a variety of dependencies, installation is unsuccessful. Finally decided to use the Apt-get installation method, the use of Apt-get install mysql-server found as if there is no real installation, online check the following roughly means that MySQL is not uninstalled cleanly , and then use the command:
Install
Look at the log seems more reliable, but error:update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn‘t exist
Then continue Google, and finally find a solution:
sudo apt-get remove--purge mysql-\*sudoinstall mysql-server mysql-client
Clear MySQL and reload.
Found in this post:
Http://askubuntu.com/questions/643251/having-trouble-in-installing-and-removing-mysql-in-ubuntu
Finally, I can finally get into MySQL again. Because of the need for remote connection, you need to modify the configuration file, the front said mysql5.7.16 my.cnf inside only two lines, with the author has encountered different, as if pointing to other files:
!includedir/etc/mysql/conf.d/!includedir/etc/mysql/mysql.conf.d/
Online to find the next said is in the/etc/mysql/mysql.conf.d inside, sure enough in the path /etc/mysql/mysql.conf.d/mysqld.cnf is the real configuration file path . Then MySQL remote connection How to configure in the author another article: http://www.cnblogs.com/symen/p/5021857.html here can be seen.
Linux MySQL reload problem