LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-28-2005, 07:47 PM   #1
kizuna
LQ Newbie
 
Registered: Mar 2005
Distribution: Slackware 10.1
Posts: 24

Rep: Reputation: 15
MY SQL cant connect to sock


I installed My SQL and when i try to start the it up i get this
Code:
~# mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
Any ideas to why this is happening and how to fix it.
thanks in advanced
 
Old 03-28-2005, 07:56 PM   #2
BrianW
Member
 
Registered: Jul 2003
Location: Montana
Posts: 297

Rep: Reputation: Disabled
Quote:
/etc/rc.d/rc.mysql

# Before you can run MySQL, you must have a database. To install an initial
# database, do this as root:
#
# su - mysql
# mysql_install_db
#
# 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').
Try this.
 
Old 03-28-2005, 08:19 PM   #3
kizuna
LQ Newbie
 
Registered: Mar 2005
Distribution: Slackware 10.1
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by BrianW
Try this.
nope still getting the sme message
 
Old 03-29-2005, 11:45 PM   #4
raven.sorrow
Member
 
Registered: Oct 2004
Distribution: Gentoo/FBSD/Slack
Posts: 65

Rep: Reputation: 15
I have a slack10 distro running the stock kernel (2.4.26) the default mysql package refused to start perperly so I removed it and built mysql frrom source, this worked flawwlessly. After that I followed these commands:

Code:
/etc/rc.d/rc.mysqld start
then

Code:
su - mysql
cd /usr/local/mysql/bin
./mysql_install_db
exit
/usr/local/mysql/bin/mysqladmin -u root password 'SoMePaSs'
I got this error:

Code:
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
root@biggeek:/usr/local/mysql#

/tmp/mysql.sock doesn't exist. I can create the file but what port/socket goes in the file so mysql knows how to connect to itself?
 
Old 11-11-2005, 05:14 PM   #5
Patchy
LQ Newbie
 
Registered: Aug 2005
Distribution: Kubuntu edgy
Posts: 25

Rep: Reputation: 15
Quote:
Originally posted by raven.sorrow
I have a slack10 distro running the stock kernel (2.4.26) the default mysql package refused to start perperly so I removed it and built mysql frrom source, this worked flawwlessly. After that I followed these commands:

Code:
/etc/rc.d/rc.mysqld start
then

Code:
su - mysql
cd /usr/local/mysql/bin
./mysql_install_db
exit
/usr/local/mysql/bin/mysqladmin -u root password 'SoMePaSs'
I got this error:

Code:
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
root@biggeek:/usr/local/mysql#

/tmp/mysql.sock doesn't exist. I can create the file but what port/socket goes in the file so mysql knows how to connect to itself?
The 2 at the end means the mysql service isn't started. In SuSE, i use the command "rcmysql start" to start the mysql server.

Edit: my reasoning is that code 2 means mysql.sock doesn't exist. When the mysql server is started it creates the mysql.sock file. When the mysql server is stopped (e.g. when the computer is shut down) it removes it.

I am having the code 111 error like the topic starter. Attention back on this please?

I had code 111 error with SuSE 9.3 as well as 10.0. It was 'fixed' in 9.3 by manually restarting the server ("rcmysql restart") after it had automatically started at boot time. This doesn't work for SuSE 10.0.

The problem happened while I was configuring apache2 to have virtual sites. I had also used phpmyadmin to change user permissions in the mysql table.

Edit2:

In mysqld.log:
Quote:
051111 23:43:13 mysqld started
/usr/sbin/mysqld: Can't read dir of '/var/lib/mysql/tmp/' (Errcode: 2)
/usr/sbin/mysqld: Can't create/write to file '/var/lib/mysql/tmp/ibsf1v7z' (Errcode: 2)
051111 23:43:13 InnoDB: Error: unable to create temporary file; errno: 2
051111 23:43:13 [ERROR] Can't init databases
051111 23:43:13 [ERROR] Aborting

051111 23:43:13 [Note] /usr/sbin/mysqld: Shutdown complete

051111 23:43:13 mysqld ended
Any more thoughts?

Last edited by Patchy; 11-11-2005 at 05:47 PM.
 
Old 11-11-2005, 05:45 PM   #6
Namaseit
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 325

Rep: Reputation: 30
use /etc/rc.d/rc.mysql start to start mysql. you might have to chmod it so you can execute it.

make sure your /var/lib/mysql directory is owned by the myqsl user and not root otherwise you'll be banging your head again.
 
Old 11-11-2005, 06:03 PM   #7
Patchy
LQ Newbie
 
Registered: Aug 2005
Distribution: Kubuntu edgy
Posts: 25

Rep: Reputation: 15
SOLVED

Following my post and edit 2.

I have:

- Stopped the mysql server using the SuSE command "rcmysql stop". I expect something like "/etc/rc.d/rc.mysql stop" for Slack'.
- Modified /etc/my.cnf so that [mysqld] has a datadir= variable, the path to the data. For me it is "/var/lib/mysql".
- Removed any existing mysql.sock file.
- Created a directory in the same directory that mysql.sock is created in called 'tmp' and given its ownership to user 'mysql' and group 'mysql'
- Started the mysql server.

It now works fine.
 
Old 11-12-2005, 07:49 AM   #8
raven.sorrow
Member
 
Registered: Oct 2004
Distribution: Gentoo/FBSD/Slack
Posts: 65

Rep: Reputation: 15
I as well solved this problem. When I had did this, I had changed my /tmp over to it's own partition to aliviate space issues on /. I neglecvted to 'chmod 1777 /tmp/' once I had done this, it allowed mysql to create '/tmp/mysql/sock' as it's self and it worked but I have since moved away from slack10 and use Gentoo now. A Much better, powerful and robust OS IMHO.
 
  


Reply



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
can't connect mysql.sock error mabus92920 Linux - Newbie 6 04-15-2005 10:38 PM
can't connect to mysql through socket '/tmp/mysql.sock' Boby Programming 2 05-23-2004 01:32 PM
can not connect to sql with php gkaffen338 Linux - Newbie 5 04-22-2004 11:36 AM
Connect to SQL Server dhome Linux - Software 1 03-08-2004 12:56 PM
Use SSH to connect MS SQL Servers jweag Linux - Networking 2 11-12-2003 09:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:16 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
Open Source Consulting | Domain Registration