LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Slack13 - Can't start mysql; can't find mysql.sock? (https://www.linuxquestions.org/questions/linux-newbie-8/slack13-cant-start-mysql%3B-cant-find-mysql-sock-769197/)

Jayla 11-14-2009 07:12 PM

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

Wim Sturkenboom 11-14-2009 10:44 PM

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.

Smartpatrol 11-14-2009 11:50 PM

...

joedial 11-14-2009 11:54 PM

On my slackware 12 box, its /etc/rc.d/rc.mysqld that starts mysqld

egrep 11-15-2009 12:35 AM

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

Hangdog42 11-15-2009 08:06 AM

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)

Wim Sturkenboom 11-15-2009 08:46 AM

Quote:

Originally Posted by Hangdog42 (Post 3757743)
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.

Hangdog42 11-15-2009 08:54 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 3757767)
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.

egrep 11-15-2009 11:50 AM

/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

ZloySergant 11-16-2009 01:04 AM

Quote:

Originally Posted by Jayla (Post 3757333)
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).

imciberrana43 11-16-2009 03:22 PM

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.

help40 11-25-2009 06:10 AM

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



All times are GMT -5. The time now is 03:39 AM.