VincentLawlor
asked on
MySQL cannot connect to local MySQL server, why?
Hi All,
My first foray into the land of MySQL and Linux initially looked ok but after a reboot of my machine I am now getting the following.
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)
It's mysql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)
My first foray into the land of MySQL and Linux initially looked ok but after a reboot of my machine I am now getting the following.
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock
It's mysql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)
ASKER
Hi I have tried what you have suggested and here is what I get:
for ps ax | grep mysqld I get:
8586 pts/2 R 0:00 grep mysqld
for ps ax | grep mysql i get:
8591 pts/2 R 0:00 grep mysql
for "/etc/init.d/mysqld start" or "/etc/init.d/mysql start" I get:
no such file or directory
for chkconfig --add mysqld
chkconfig: command not found
for ps ax | grep mysqld I get:
8586 pts/2 R 0:00 grep mysqld
for ps ax | grep mysql i get:
8591 pts/2 R 0:00 grep mysql
for "/etc/init.d/mysqld start" or "/etc/init.d/mysql start" I get:
no such file or directory
for chkconfig --add mysqld
chkconfig: command not found
Your ps should show something like:
7824 ? S 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cn f --pid-file=/var/run/mysqld /mysqld.pi d
7853 ? Sl 8:25 /usr/libexec/mysqld --defaults-file=/etc/my.cn f --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld /mysqld.pi d --skip-locking
There should be something in /etc/init.d/ related to mysql, database, or something. chkconfig lives at /sbin/chkconfig. You have to be logged in as root, of course. If you're using "su" to get root permissions, make sure you use "su -". The '-' creates a login-type shell with the correct paths for the root user and utilities.
I just noticed that your MySQL version says for "redhat-linux-gnu", so I assumed you were using RedHat. What linux Distribution are you using? What version?
7824 ? S 0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cn
7853 ? Sl 8:25 /usr/libexec/mysqld --defaults-file=/etc/my.cn
There should be something in /etc/init.d/ related to mysql, database, or something. chkconfig lives at /sbin/chkconfig. You have to be logged in as root, of course. If you're using "su" to get root permissions, make sure you use "su -". The '-' creates a login-type shell with the correct paths for the root user and utilities.
I just noticed that your MySQL version says for "redhat-linux-gnu", so I assumed you were using RedHat. What linux Distribution are you using? What version?
ASKER
I am using RedHat Enterprise Release 2.4.21-4.EL
Nothing in /etc/init.d/ related to mysql
ps has the same result if I log in as root using "su -" but chkconfig runs
Nothing in /etc/init.d/ related to mysql
ps has the same result if I log in as root using "su -" but chkconfig runs
ASKER
Problem solved by uninstalling the MySQL packages and re-installing the rpms.
Looked like the daemon was missing.
Can I have this one closed and points refunded. Problem solved.
Thanks.
Looked like the daemon was missing.
Can I have this one closed and points refunded. Problem solved.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check "ps ax | grep mysqld" to see if it's running.
To start MySQL, run "/etc/init.d/mysqld start" or "/etc/init.d/mysql start"
Adding MySQL to the boot script varies by Linux distribution. For RedHat, use:
chkconfig --add mysqld
chkconfig mysqld on