LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 11-14-2009, 07:12 PM   #1
Jayla
Member
 
Registered: Nov 2005
Location: Suffolk, UK
Distribution: kubuntu 9.04
Posts: 188

Rep: Reputation: 30
Slack13 - Can't start mysql; can't find mysql.sock?


I've installed slackware 13.0 on virtual box

I've then installed mysql by running

Code:
slackpkg install package mysql
And followed any prompts with defaults.

I have created a mysql user and group, and can verify these by su'ing to the mysql user or checking /etc/password

When I try to run mysql, using mysql I get the following

Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
I've checked that directory, its empty

I've done some googling regarding that missing sock file and apparently it can be in a number of places depending on your distro, but I still couldn't find it. Also tried the following with no luck (may be incorrect command)

Code:
find / -u mysql.sock | cat > searchResults
Any ideas? Once I can find this file, I'll update my.cnf and it should be OK
 
Old 11-14-2009, 10:44 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
The error usually means that you don't have mysqld ruuning. I'm not familiar with version 13, but in earlier Slackware releases you had to make /etc/rc.d/rc.mysqld executable and start it.
Please read that script first as it contains instructions how to setup the initial databases.

Last edited by Wim Sturkenboom; 11-15-2009 at 04:13 AM. Reason: OOPS, had the wrong service (httpd) instead of mysqld
 
Old 11-14-2009, 11:50 PM   #3
Smartpatrol
Member
 
Registered: Sep 2009
Posts: 196

Rep: Reputation: 38
...

Last edited by Smartpatrol; 03-11-2010 at 09:50 PM.
 
Old 11-14-2009, 11:54 PM   #4
joedial
LQ Newbie
 
Registered: Sep 2004
Location: Hampton, VA
Distribution: Slackware 8-13
Posts: 2

Rep: Reputation: 0
On my slackware 12 box, its /etc/rc.d/rc.mysqld that starts mysqld
 
Old 11-15-2009, 12:35 AM   #5
egrep
LQ Newbie
 
Registered: Aug 2004
Location: Bremerton WA
Distribution: Slackware
Posts: 20

Rep: Reputation: 0
mysql.sock gets created _once_ mysqld starts up and is able to bind to the port. If I am not misaken, you usually have to star mysqld as root, and it will "switch" to the mysql user [much like apache does when it switches to the user apache after starting].

o are you starting mysql as root? You might try it if not.
o make sure you have not created a funky 'data' directory for mysql. The .sock file gets created there and expects any parent directories to be in place.
o also, make sure you are starting mysql [the client part], passing in the correct info:
Code:
$ mysql -u user -p [enter]
password: [enter pass][enter]
I think that is the sequence. I rarely get mysql to connect if I pass the password on the initial command line. Also, make sure you have created the initial root user [examples are in the readme's - not sure where slackpkg puts mysql.

Doesn't slack come with mysql already as an installable package? I would look for that on the install cd's.

--steve
 
Old 11-15-2009, 08:06 AM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Getting mysql running on slackware requires 3 steps

1) Creating a my.cnf from one of the my-*.cnf examples in /etc
2) Making /etc/rc.d/rc.mysqld executable and starting it (by the way, you need to edit this file if you want to access mysql over tcp/ip rather than via a socket).
3) If you've never run mysql before on the machine, you need to run the mysql_install_db as root to initialize stuff

In addition it is a really good idea to set a password for the root mysql user (which is NOT the same thing as the system root user)

Last edited by Hangdog42; 11-15-2009 at 08:07 AM.
 
Old 11-15-2009, 08:46 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by Hangdog42 View Post
3) If you've never run mysql before on the machine, you need to run the mysql_install_db as root to initialize stuff
Unless the script in Slackware 13 has changed compared to previous versions, please do NOT run it as root. Login as root, issue su - mysql and next run the script.

If you run as root, the owner/group and permissions are not correct.
 
Old 11-15-2009, 08:54 AM   #8
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by Wim Sturkenboom View Post
Unless the script in Slackware 13 has changed compared to previous versions, please do NOT run it as root. Login as root, issue su - mysql and next run the script.

If you run as root, the owner/group and permissions are not correct.

You're right, I was forgetting an important part that is explained in /etc/rc.d/rc.mysqld

Code:
# Before you can run MySQL, you must have a database.  To install an initial
# database, do this as root:
#
#   mysql_install_db --user=mysql
That does the same thing as your su suggestion I believe.
 
Old 11-15-2009, 11:50 AM   #9
egrep
LQ Newbie
 
Registered: Aug 2004
Location: Bremerton WA
Distribution: Slackware
Posts: 20

Rep: Reputation: 0
/egrep stands corrected - I have not run mysqld on slack for a long time. On the Red Hat work systems, the mysql user does not exist so we have to set up permissions manaully. Maybe we should push to have the app id added ;-]

--steve
 
Old 11-16-2009, 01:04 AM   #10
ZloySergant
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by Jayla View Post
I've installed slackware 13.0 on virtual box

I've then installed mysql by running

Code:
slackpkg install package mysql
And followed any prompts with defaults.

I have created a mysql user and group, and can verify these by su'ing to the mysql user or checking /etc/password

When I try to run mysql, using mysql I get the following
FOA, make sure you've read /etc/rc.d/rc.mysqld - it's got basic info on mysql in Slackware. Then, follow basic steps already posted above (and shown in rc.mysqld).
 
Old 11-16-2009, 03:22 PM   #11
imciberrana43
LQ Newbie
 
Registered: Jul 2007
Location: New York City
Distribution: Slackware 10.2
Posts: 7

Rep: Reputation: 1
jayla, as stated by hangdog42, you need to go into /etc directory and see if you've an existing my.cnf that needs to be configured. If there are only the my-*.cnf files, you'll need to select and configure one. At the same time, you need to check the .cnf file for the directory that the mysql.socket will be located.
Hope this helps you.
 
Old 11-25-2009, 06:10 AM   #12
help40
LQ Newbie
 
Registered: Sep 2009
Posts: 3

Rep: Reputation: 0
I have similar problem

mysql is not working or I do not know ?
I am able to access it by "mysql" shell command, but I can not access by phpmyadmin ... or so

I made
Code:
ln -s /var/run/mysql/mysql.sock /tmp/mysql.sock
Now mysql work


I do not know why this is needed, here is my /etc/my.cnf

Code:
root@serv:/etc# cat /etc/my.cnf

[mysqld]
datadir =/var/lib/mysql
port    =3306
socket  =/var/run/mysql/mysql.sock

[mysql.server]
user        =mysql
basedir     =/var/lib

[safe_mysqld]
err-log     =/var/log/mysqld.log
pid-file    =/var/run/mysql/mysql.pid

Last edited by help40; 11-25-2009 at 06:13 AM.
 
  


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
Fedora 9:No mysql.sock file found. Cannot start mysql smilingbuddha Linux - Software 3 03-21-2009 03:06 AM
MySQL 5.0.67: Unable to install & run. Error /var/lib/mysql/mysql.sock' (2) peteyperson Linux - Server 2 03-04-2009 01:16 PM
Having problems installing MySQL on red hat 9. Cannot find mysql.sock oferu Linux - Newbie 3 05-27-2008 07:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mohadesz Linux - Server 3 03-15-2008 05:06 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' mathimca05 Linux - Newbie 2 10-17-2007 02:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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