Solving Error 2002(HY000)Can’t connect to MySQL server.

Mediawiki’s installation is quite simple if the correct steps are followed and applied but it may happen that during the installation a package was not correctly configured or worse , broken. Rest assured , you do not need to uninstall ubuntu , at least not now.

Screenshot_2018-11-06 ERROR 2002 (HY000) Can't connect to local MySQL server through socket ' var run mysqld mysql sock' (2[...]

When the MySQL server connects to the localhost, it attempts to use a socket file instead of TCP/IP(Transmission Control Protocol / Internet Protocol). The socket file used is specified in etc/mysql/my.cnf when My SQL server is installed on the system. So what you need to do is change socket to the location of your MemSQL socket file.

/etc/mysql/my.cnf you should see this near the top of the file:

Screenshot_2018-11-06 ERROR 2002 (HY000) Can't connect to local MySQL server through socket ' var run mysqld mysqld sock'

Just change the socket file to /var/lib/memsql/data/memsql.sock.

Now try mysql -u root -p again. This should do the job

If you still get the same error, the process might not be running on your current version of Ubuntu. So type ps ax | grep mysql terminal to see if it is running.

If it is not ,then use command sudo service mysql start or sudo /etc/init.d/mysql start if it says service unrecognized, to start mysql.

If none of the above worked, it might mean that mysql is installed but corrupted somehow. The solution to this is to completely uninstall mysql and installing again.

If you had installed mysql-server, omit the mysql-client part.

sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server mysql-client

Now use sudo apt-get install mysql to install mysql .

This should get your mysql working.

The solutions above are uniquely what I tried . It has worked out for me but I cannot guarantee that it will work for everyone.

 

 

Advertisements

One thought on “Solving Error 2002(HY000)Can’t connect to MySQL server.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s