LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't connect to local MySQL server through socket (https://www.linuxquestions.org/questions/linux-newbie-8/cant-connect-to-local-mysql-server-through-socket-185564/)

tommytomato 05-25-2004 05:28 AM

Can't connect to local MySQL server through socket
 
Hi guys

working on a remote PC, Tiny sofa OS, my brothers machine

I'm walked me through the setup and adding the root password for mysql and creating a database etc and all went well.

How ever contecting to the system again to add another database we get the following error.

root@localhost /etc# mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (111)


can any one tell us whats going on please

TT

xanas3712 05-25-2004 05:33 AM

hmm....... if you have updated your locate database first thing I'd do is

locate mysql.sock and make sure it's actually in that location, if not I think the mysqld.conf in /etc/ will allow you to change it.. but you used it before and it worked fine right?

Also, I think you may have to chown or something like that.. I did this a couple days ago..

EDIT: it was rc.mysqld on my system, but anyway, this may be the problem here....

# Note that step one is becoming the mysql user. It's important to do this
# before making any changes to the database, or mysqld won't be able to write
# to it later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').

tommytomato 05-25-2004 05:45 AM

Opps, i didn't do update db at start.

but the mysql.sock is where it says it is.

and i cant find mysql.conf

TT

xanas3712 05-25-2004 05:46 AM

Like I said above, I was wrong.. on my system it's rc.mysqld in /etc/rc.d/rc.mysqld but this is slackware so things are a little different.

Anyhow, just do the "this line will fix it" that includes chown, as I think I did that and it made it work for me..

tommytomato 05-25-2004 05:57 AM

All i can find is this

under /etc/init.d/mysql

PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

# Set some defaults, don't change them here, use /etc/my.cnf
datadir=/var/lib/mysql
sockdir=/var/run/mysql
basedir=
pid_file=

and in the my.cnf we have

# Example mysql config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# a important part and systems up to 128M very MySQL is used together with
# other programs (like a web server)
#
# You can copy this file to
# /etc/mf.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /home/mysql/var) or
# ~/.my.cnf to set user-specific options.
#
# One can in this file use all long options that the program supports.
# If you want to know which options a program support, run the program
# with --help option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/run/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/run/mysql/mysql.sock
skip-networking

[mysqldump]

[mysql]

[isamchk]

[myisamchk]

[mysqlhotcopy]


TT :study:

tommytomato 05-25-2004 06:42 AM

we have check every thing we know of and still get these errors

root@localhost ~# /etc/init.d/mysql restart
No MySQL daemon pid file found. Looked for /var/lib/mysql/localhost.localdomain.
pid. [FAILED]
Starting MySQL daemon: [ OK ]
root@localhost ~# mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/m
ysql.sock' (111)


TT

Danielallan 05-25-2004 09:16 AM

Hello,

Have you ran the "mysql_install_db" script, it should be in your /usr/bin. Also be sure to "chmod 755 /var/run/mysql/mysql.sock" then restart the with "/usr/bin/mysqld restart". This should do the trick, I have been using slackware and that is what I have to do when reinstalling. Hope this helps!

Sincerely,

Danielallan


All times are GMT -5. The time now is 08:13 PM.