ERREUR 2002 (HY000) :

Solved
lemaire -  
 IALY -
Hello,

when I try to restart MySQL on Linux, I get this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

could you help me?

thank you for your response

lemaire

15 réponses

mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927
 
In my opinion, there is an error or inconsistency in /etc/mysql/my.cnf if you don't have the file /var/run/mysqld/mysqld.sock.

Typically, you should have something like this:

.... # This was formally known as [safe_mysqld]. Both versions are currently parsed. [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english skip-external-locking ...


Backup /etc/mysql/my.cnf beforehand, just in case.

To regenerate this file, you can reinstall the package. Normally, under Debian/Ubuntu, you just need to run:

sudo dpkg-reconfigure mysql-server sudo service mysql restart


If that doesn't change anything, reinstall the package. For example, under Debian, Ubuntu, etc...

sudo apt-get update sudo apt-get install aptitude sudo aptitude update sudo aptitude safe-upgrade sudo rm /etc/mysql/my.cnf sudo aptitude reinstall mysql-server


Good luck.
5
sfida
 
Hello

I have already installed my network services such as: MySQL, Apache, LDAP, DHCP, Samba, DNS via the command yum install service name
and every time I open the terminal I have to type the following command: mount -o loop /dev/cdrom /mnt/iso/rhel5
Now I would like to know how to check if MySQL exists, how to start it, and how to verify if the connection works.

I tried to start the server as you indicated with the command /etc/init.d/mysql start (as root)
but it gives me the following message: permission denied.
0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927
 
@sfida: your question is unrelated to the initial topic. I will briefly answer your inquiries, but if you're still stuck, please create a new thread ("Ask your question at the following link):
https://forums.commentcamarche.net/forum/linux-unix-13

and each time I open the terminal I have to type the following command: mount -o loop /dev/cdrom /mnt/iso/rhel5

Why? Because the packages you are installing are downloaded from a CD?

Now I would like to know how to check if MySQL exists, how to start it and test the connection if it works.

rpm -qa | grep mysql /etc/init.d/mysql start ps aux | grep mysql mysql -u root -p


but it returns the following message: permission denied

You need to run it as root.

Good luck
0
IALY
 

It helped me, thank you

0