Click to See Complete Forum and Search --> : MySQL Cannot Connect?
ikemup
05-06-2001, 10:09 AM
using redhat 7.0... when trying to connect to the mysql server using command:
mysql -h localhost
i always receive the error:
Error2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
this file does not exist, should it be created?...
i know that the client works fine, i've used it to connect to other remote MySQL servers... is this a problem related to installation?.. the server was installed when i installed redhat, along with apache - which works fine...
by the way, i'm attempting to migrate from a complete microsoft solution to complete linux, maybe that'll motivate you veterans into responding...
so far, i love linux!
thanks in advance!
Lorithar
05-06-2001, 10:29 AM
*ummm*
You say that mysql was installed .... does it start ..(ps -ef |grep mysql) ... I post installed the mysql build on my slackware box and had to modify the startup scripts to handle several issues.
If it has started, try connecting to the default TCP port as well which iirc is 3306 ... the localhost pipe has to be configured, and in some cases is not as it can be a security hole ..
In my installation I have the localhost socket in /tmp/.mysql/var/mysql.sock
so .. the file may not be where your client expects it either .. (this is configurable)
what does /etc/my.cnf say about your installation? ...
Sensei
05-06-2001, 10:57 AM
sometiems you have to have thef ull path to your mysql.sock vs just localhost.
I use /tmp/mysql.sock, but I think the default is /var/lib/mysql/mysql.sock not sure.
remember to append the -p when using mysql as well or sometimes you will get that error.
Oh you need to type in your default pass with the -p flag.
ikemup
05-06-2001, 11:03 AM
why am i not surprised?... the file my.conf exists, but is empty... i guess that i will try installing it again... but i am concerned that there may be consequences... when reading up on apache, every piece of documentation said to install mysql first... will this be problem?...
Lorithar
05-06-2001, 11:04 AM
*umm*
Sensei ... dropping the password (-p) gets me a password failure message since I have mysql locked down (everyone needs a password, including root@localhost) ...and for some reason I've never been able to pass the password through the command line... I add the -p without a password string and it prompts me afterward .. I remember reading why, but it's completely slipped my mind ... (too much input lately)
Lorithar
05-06-2001, 11:11 AM
*ummm* ...
/etc/my.conf is empty?
Where did mysql get installed ... there is a post install step to build the primary security databases and the install by default DOES NOT run this .. as there are several things that need to be configured. ...
This does depend on which installation process you used, although it sounds like you likely installed a prebuilt binary rather than building from source.
On my system mysql is in /opt/mysql ... which is in my path statement, and there are several entries in /etc/profile to point to mysql
from /opt/mysql the step I refer to is to run bin/mysql_install_db which does a lot of work setting up the server..