Question

"ERROR 2002 (HY000): /tmp/mysql.sock" How to fix it ? Ubuntu 12.04

I try change my password, but show this. how to to fix it ?

*root@TS3:~/serverpug# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)*

My system is Ubuntu 12.04


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

my sites are down about 12 hours due this problem. mysql server is running. please advise

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-11-21 00:39:38 UTC; 6s ago
  Process: 5085 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 5076 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 5084 (mysqld)
    Tasks: 13
   Memory: 104.7M
      CPU: 270ms
   CGroup: /system.slice/mysql.service
           └─5084 /usr/sbin/mysqld

Nov 21 00:39:08 ubuntu-1gb-fra1-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 21 00:39:08 ubuntu-1gb-fra1-01 systemd[1]: Stopped MySQL Community Server.
Nov 21 00:39:08 ubuntu-1gb-fra1-01 systemd[1]: Starting MySQL Community Server...
Nov 21 00:39:38 ubuntu-1gb-fra1-01 systemd[1]: Started MySQL Community Server.
root@ubuntu-1gb-fra1-01:/etc/mysql# service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-11-21 00:39:38 UTC; 33s ago
  Process: 5085 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 5076 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 5084 (mysqld)
    Tasks: 13
   Memory: 107.6M
      CPU: 281ms
   CGroup: /system.slice/mysql.service
           └─5084 /usr/sbin/mysqld

Nov 21 00:39:08 ubuntu-1gb-fra1-01 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Nov 21 00:39:08 ubuntu-1gb-fra1-01 systemd[1]: Stopped MySQL Community Server.
Nov 21 00:39:08 ubuntu-1gb-fra1-01 systemd[1]: Starting MySQL Community Server...
Nov 21 00:39:38 ubuntu-1gb-fra1-01 systemd[1]: Started MySQL Community Server.

Show This:

root@TS3:~/serverpug# service mysql status
mysql stop/waiting
root@TS3:~/serverpug# service mysql start
start: Job failed to start
root@TS3:~/serverpug#

D ;

Check that mysql is running with “service mysql status” and if you’re not sure jsut do “service mysql start” and then try again.