LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-04-2005, 11:15 PM   #1
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Rep: Reputation: 30
Starting MySQL...


I am stumped as to why this is happening, here is my output:

Code:
root@darkstar:~# chmod a+x /etc/rc.d/rc.mysqld
root@darkstar:~# /etc/rc.d/rc.mysqld start
root@darkstar:~# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysql/mysql.pid
050105 00:12:10  mysqld ended
Why is this?
When I try to run "mysql", I get the following:

Code:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
What can I do to fix this?

EDIT: I have the MySQL package "mysql-4.0.22-i486-1jim.tgz" from LinuxPackages.net.

Last edited by darkarcon2015; 01-04-2005 at 11:18 PM.
 
Old 01-05-2005, 01:31 AM   #2
SocialEngineer
Member
 
Registered: May 2003
Distribution: Slackware
Posts: 236

Rep: Reputation: 31
Well, whenever I first would try and start MySQL, it would quit because I didn't have a test database created. Check the man pages; I believe they give you the info you need.
 
Old 01-05-2005, 01:44 AM   #3
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Rep: Reputation: 50
The man pages may have the correct information. The file /etc/rc.d/rc.mysql is where most people get their information, I believe. To save you the trouble of looking, here's an excerpt that may help:

Quote:
# 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').
 
Old 01-05-2005, 03:06 PM   #4
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Okay, I tried "mysql_install_db" and it seemed to be successful (no errors) but I still can't start mysqld. I tried to set my password but it still said:

Code:
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
I really don't get this.

EDIT: I also tried "/usr/bin/mysqld_safe &" and that gave me this again:

Code:
root@darkstar:/var/lib/mysql# /usr/bin/mysqld_safe &
Starting mysqld daemon with databases from /var/lib/mysql
[1] 4164
root@darkstar:/var/lib/mysql# STOPPING server from pid file /var/lib/mysql/darkstar.pid
050105 16:09:57  mysqld ended

Last edited by darkarcon2015; 01-05-2005 at 03:11 PM.
 
Old 01-05-2005, 03:08 PM   #5
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Could you post the output of :
ls -l /var/lib/mysql
 
Old 01-05-2005, 03:12 PM   #6
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Cedrik
Could you post the output of :
ls -l /var/lib/mysql
Code:
root@darkstar:/var/lib/mysql# ls -l /var/lib/mysql
total 20568
-rw-rw----  1 mysql root      9517 2005-01-05 16:09 darkstar.err
-rw-rw----  1 mysql mysql    25088 2005-01-04 18:28 ib_arch_log_0000000000
-rw-rw----  1 mysql mysql  5242880 2005-01-05 16:09 ib_logfile0
-rw-rw----  1 mysql mysql  5242880 2005-01-04 18:28 ib_logfile1
-rw-rw----  1 mysql mysql 10485760 2005-01-05 16:09 ibdata1
drwx------  2 root  root      4096 2005-01-04 18:25 mysql
drwx------  2 root  root      4096 2005-01-04 18:25 test
[1]+  Done                    /usr/bin/mysqld_safe
 
Old 01-05-2005, 03:21 PM   #7
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
As root type :
chown -R mysql.mysql /var/lib/mysql

Then:
/etc/rc.d/rc.mysqld start
 
Old 01-05-2005, 03:30 PM   #8
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by Cedrik
As root type :
chown -R mysql.mysql /var/lib/mysql

Then:
/etc/rc.d/rc.mysqld start
Awesome, that did the trick. Thanks a lot.
 
Old 06-25-2005, 11:39 AM   #9
kaon
Member
 
Registered: Dec 2003
Location: Hong Kong SAR
Distribution: Slackware 9.1, 10.x, slackware-current
Posts: 186

Rep: Reputation: 30
Is this a bug of MySQL itself?

Should we tell Pat about that?
 
Old 06-25-2005, 03:57 PM   #10
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
It's not a bug, it's documented. The databases get bad ownership if you don't execute the commands as stated.
Probrably it would be better that mysql reports some kind of error when it can't read the databases, you could get a better start point than just "mysql ended".
 
Old 06-25-2005, 07:21 PM   #11
JohnSeth
LQ Newbie
 
Registered: Jun 2005
Location: Arizona
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
You can always tell what errors MySQL encounters by going into the /var/lib/mysql directory, and viewing the ${hostname}.err file.

MySQL documents over and over and over... and over again, that all database files must be created ("mysql_install_db") and have "chown mysql:mysql /var/lib/mysql" done on the directory prior to even attempting to startup mysql. If one were to read the documentation at MySQL's website or check their mailing list archives, it is among the top issues people encounter. In the old days, it's oft referred to as "RTFM".

If you plan on using MySQL, I strongly encourage every person to read the online manual at http://dev.mysql.com/ to learn how to setup and secure their databases. By default, just about anyone can connect and alter any database by using a MySQL client application to connect to port 3306 of a new, unprotected server.
 
Old 06-26-2005, 05:13 AM   #12
davidsrsb
Member
 
Registered: Oct 2003
Location: Kuala Lumpur, Malaysia
Distribution: Slackware 13.37 current
Posts: 770

Rep: Reputation: 33
By the way, why are you using ""mysql-4.0.22-i486-1jim.tgz" from LinuxPackages.net"
Slackware comes with a perfectly good 4.0.24 and LinuxPackages has a 4.1.11 version.
 
Old 06-26-2005, 08:44 AM   #13
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
Quote:
Originally posted by kaon
Is this a bug of MySQL itself?

Should we tell Pat about that?
A bug?
The first part of rc.mysqld file context is already posted to you.
Did you do
Code:
su - mysql
or
Code:
su mysql
as a root to become mysql user and then execute the mysql_install_db command the
mysql user and not as root?

Quote:
# 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').
 
Old 06-26-2005, 12:05 PM   #14
tuxrules
Senior Member
 
Registered: Jun 2004
Location: Chicago
Distribution: Slackware64 -current
Posts: 1,158

Rep: Reputation: 62
I am kinda having the same problem. I have mysql running fine. I have also created databases using the mysql_install_db script. However, when i go to mysql and do SHOW DATABASES;, it just shows a test database when i have two databases "test" and "mysql" in /var/lib/mysql.

Can anyone give me any pointers...i'm stumped

Edit: i've chmoded /var/lib/mysql recursively to the user and group mysql.

Last edited by tuxrules; 06-26-2005 at 12:06 PM.
 
Old 06-26-2005, 12:17 PM   #15
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
What user are you logging into mysql as? It sounds like a permission problem, as the 'mysql' table is (and should be) restricted.
 
  


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
Starting MySQL OLD Error : imeout error occurred trying to start MySQL Daemon Fr33B5D Linux - Software 9 10-28-2006 06:23 AM
Help starting up mysql . rullman Linux - Software 4 05-24-2004 05:00 AM
Starting up MySQL bwreath Linux - Software 2 01-20-2004 03:20 PM
starting mysql apax Linux - Newbie 4 12-28-2003 07:50 AM
starting mysql studentforever Linux - Software 10 09-18-2003 04:34 PM

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

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