Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have Slackware 9.1 setup perfect the way I want it, during the Slackware setup, I had it run MySQL on startup, now my problem is ... when Slackware starts up, right before I get to the login prompt... it says
"MySQL has stopped" ... or something of that sort.
When I try a "mysql" command on the CLI ... I get the error...
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
I don't know where to start to remedy this. LAMP was the main reason I set up a box just to develop and test web applications at home.
There are a couple of things you need to check. First, dig into your mysql log and see if there is more information there on what is going wrong. Your mysql log should be in your mysql data directory with the name "hostname".err where hostname is the name of your computer.
While your at it, check your syslog and message logs as well.
Finally, please post the full command you are using to start mysql.
I noticed the same issue on my install. This should clear up the problem:
From /etc/rc.d/rc.mysqld (Slack 9.1) ...
# 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').
I think nightwulf has hit the nail on the head. Your error message suggest that the initial database set up wasn't done or didn't complete. You might want to have a read through the MySql post install documentation for a more detailed description of how to do what nightwulf has suggested.
Just a few other observations.......
The mysqld_safe command, without any other modifications, will try to run mysql as the current user. So if you are currently logged in as root, mysqld will be run as root (a bad idea by the way) and if you are logged in as a normal user, it will try to run as that user. Just to be safe, most people create a normal user (mysql) and modify the my.cnf file to run as that user.
Both the syslog and the messages can be found in /var/logs. You can also access the syslog with teh dmesg command (which has to be run as root).
Thank you for everyone's help! I solved it. I've read through the previous MySQL post install docs for hours ... all they had to tell was su to mysql and I would have solved it. I was doing everything as root and it didn't seem to run. I have created a mysql user and group and now mysqld runs as mysql.
I'm curious ... I have mysqld running as mysql ... but mysql_safe is running as root. Is this anything I should be concerned about?
You can run mysqld_safe as mysql with the --user= flag (mysqld_safe --user=mysql &). Personally, my opinion is that if you can run something as non-root, you should.
Quote:
all they had to tell was su to mysql and I would have solved it
I'm not sure I get what you did to solve the problem. From the errors you posted earlier, it sounded like you hadn't run the install scripts, but this doesn't suggest that is what you did. I'd appreciate it if you would post a few more details about how you actually did solve the problem.
I actually did run the mysql_install_db script as root ... but then running mysqld_safe didn't do anything. It didn't seem to create what the daemon required.
These are the commands I did exactly to get mysqld up and running:
Quote:
su mysql
chown -R mysql.mysql /var/lib/mysql (I had to do this because mysql didn't have permissions to it, and couldn't run mysql_install_db)
mysql_install_db
mysqld_safe &
I ran mysqladmin version to verify that mysql was indeed up and running and it gave me the following output:
Quote:
mysqladmin Ver 8.40 Distrib 4.0.15a, for slackware-linux on i486
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.0.15a
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/run/mysql/mysql.sock
I changed the mysql root password, rebooted, and MySQL started automatically and is working great.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.