• ERROR 2002(HY000) Can't connect to MySQL server
    June 22, 2019

    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.

    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.

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

    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 in 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.

    • 1. sudo apt-get remove --purge mysql*
    • 2. sudo apt-get autoremove
    • 3. sudo apt-get autoclean
    • 4. 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.