LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 01-05-2004, 05:12 AM   #1
wenberg
Member
 
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

Rep: Reputation: 15
Slackware & MySQL help


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.
 
Old 01-05-2004, 05:31 AM   #2
wenberg
Member
 
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

Original Poster
Rep: Reputation: 15
When starting MySQL manually using: mysql_safe & ... I get the following...

[1] 3286
root@wenberg:/tmp# Starting mysqld daemon with databases from /var/lib/mysql
040105 19:34:59 mysqld ended

I look at the process list, and the MySQL daemon still isnt running.
 
Old 01-05-2004, 07:39 AM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
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.
 
Old 01-05-2004, 11:10 AM   #4
wenberg
Member
 
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

Original Poster
Rep: Reputation: 15
The last errors on the mysql error log is:

Quote:
040106 01:09:51 mysqld started
040106 1:09:51 InnoDB: Started
040106 1:09:51 Fatal error: Can't open privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
040106 1:09:51 Aborting

040106 1:09:51 InnoDB: Starting shutdown...
040106 1:09:53 InnoDB: Shutdown completed
040106 1:09:53 /usr/libexec/mysqld: Shutdown Complete

040106 01:09:53 mysqld ended
Where can I find the syslog and message logs?

I've read the docs on mysql.org concerning host.frm, but I didn't get anywhere.

The command I used to start MySQL manually is /usr/bin/mysqld_safe. I get the following output after that command...

Quote:
Starting mysqld daemon with databases from /var/lib/mysql
040106 01:14:39 mysqld ended
 
Old 01-05-2004, 12:42 PM   #5
nightwulf
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 35

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

Hope this helps.

Regards,
nightwulf

Last edited by nightwulf; 01-05-2004 at 12:43 PM.
 
Old 01-05-2004, 01:54 PM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
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).
 
Old 01-05-2004, 07:35 PM   #7
wenberg
Member
 
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

Original Poster
Rep: Reputation: 15
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?
 
Old 01-05-2004, 10:08 PM   #8
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
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.
 
Old 01-05-2004, 10:45 PM   #9
wenberg
Member
 
Registered: Jan 2004
Location: Minnesota, USA
Distribution: Slackware 10, Debian Sarge
Posts: 91

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

Last edited by wenberg; 01-05-2004 at 10:47 PM.
 
  


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
DISCUSSION: Slackware guide for AMP Apache MySQL and PHP xushi LinuxAnswers Discussion 12 09-23-2007 01:32 PM
Slackware guide for AMP Apache MySQL & PHP xushi Slackware 35 05-11-2006 11:18 AM
PHP & MySQL on Slackware 10.2 pau_kacang Slackware 2 11-10-2005 07:57 AM
(FreeBSD && Fedora Core 4 && Slackware 10.0) Filesystem Support taylor_venable *BSD 1 07-14-2005 02:24 PM
From RedHat9 to FreeBSD (Apache 2 & Mysql & PHP 4) guardian653 *BSD 5 12-11-2003 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:15 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