LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2004, 06:28 AM   #1
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Rep: Reputation: 32
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
 
Old 05-25-2004, 06:33 AM   #2
xanas3712
Member
 
Registered: Apr 2004
Distribution: Slackware/Mandrake/Debian (sarge)
Posts: 266

Rep: Reputation: 30
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').

Last edited by xanas3712; 05-25-2004 at 06:37 AM.
 
Old 05-25-2004, 06:45 AM   #3
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Original Poster
Rep: Reputation: 32
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
 
Old 05-25-2004, 06:46 AM   #4
xanas3712
Member
 
Registered: Apr 2004
Distribution: Slackware/Mandrake/Debian (sarge)
Posts: 266

Rep: Reputation: 30
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..
 
Old 05-25-2004, 06:57 AM   #5
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Original Poster
Rep: Reputation: 32
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

Last edited by tommytomato; 05-25-2004 at 06:59 AM.
 
Old 05-25-2004, 07:42 AM   #6
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Original Poster
Rep: Reputation: 32
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
 
Old 05-25-2004, 10:16 AM   #7
Danielallan
Member
 
Registered: Aug 2003
Location: KY
Distribution: Slackware 10/BSD
Posts: 32

Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
Can't connect to local MySQL server through socket . . . patpawlowski Programming 2 01-23-2004 04:03 PM


All times are GMT -5. The time now is 12:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration