Fedora Linux Support Community & Resources Center
  #1  
Old 16th September 2006, 09:08 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
#/etc/init.d/mysqld start FAILS won't start mysql

Bare with me you might see similar help messages but this is more to the point.

I CAN LOAD MYSQL WITH:
#/usr/bin/mysqld_safe &


When it runs at boot it hangs momentarily
I find this error statement in:/var/log/mysqld.log
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

When I try and start mysql from a root command line with
/etc/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
touch: cannot touch `/var/lock/subsys/mysqld': Permission denied


I tired to
#chmod mysql /var/lock/subsys/mysqld
but this is not allowed ....even by root usr !!!

There's also a binary file called
host.frm
Somehow I think this might be tied into this verry annoying problem.

But I need to get mysql loading at boot
How can I fix this??

I can not get a full nights sleep until I get this fixed.

Can I remove mysql and reinstall on FC5. Will it clean off all the files? Maybe this is the only solution

thank you

Last edited by cwynn; 17th September 2006 at 01:48 AM.
Reply With Quote
  #2  
Old 17th September 2006, 01:15 AM
daverj Offline
Registered User
 
Join Date: Jan 2006
Location: Denver, CO USA
Posts: 670
first, "chmod mysql" will NEVER work because chmod is used to change permissions; mysql is not permissions. Second, you don't want to change ownership of the files in /var/lock/subsys as they should be owned by root.

That being said, show us the content of /etc/my.cnf. mysql refers to that file, if it exists, for startup parameters. This might help fixing the problem.

davidj
Reply With Quote
  #3  
Old 17th September 2006, 01:46 AM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
follow up to first reply

Ask me every thing you can think of that might get me beyond this point... it's beyond me?
This is the contents of "my.cnf" you asked for

recall that I said I can run it up from a command line as in
#su
#/usr/bin/mysqld_safe --user=root &
So the question is why at Level #3 of boot it can not do the same thing? At least that seems to me be somehow figuring into this

thanks for your input

Quote:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
skip-innodb

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

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
edited 8:02 pm cst
I've been going non stop on this one error all day for 12 hrs. .. I need to take a break... hope to hear from you and others that might suggest a solution... I'm thinking of going to a reinstallation...if I remove mysql I'd better remove php too right? or is that not necessary.

Last edited by cwynn; 17th September 2006 at 02:06 AM.
Reply With Quote
  #4  
Old 17th September 2006, 02:28 AM
wdingus Offline
Registered User
 
Join Date: Aug 2005
Location: Kingsport, TN
Posts: 117
The error pretty much says it all

Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

The host "table" in the mysql "database" is non-existent. Either it was deleted or the initial mysql install was not entirely successful or something like that. Whatever the reason, it's not there and needs to be. The dir /var/lib/mysql/ is where all databases (or at least database descriptions) are stored. In there are directories, one per database you have. The "mysql" database is where users/passwords are stored, the host table is where permissions related to what hosts can/can't connect to the server are. For most folks this is an empty table but nonetheless, the files must exist.

[root@pc /]# cd /var/lib/mysql/mysql
[root@pc mysql]# ls -al host*
-rw-rw---- 1 mysql mysql 9416 Mar 21 18:32 host.frm
-rw-rw---- 1 mysql mysql 0 Mar 21 18:32 host.MYD
-rw-rw---- 1 mysql mysql 1024 Mar 21 18:32 host.MYI

Get 'em from somewhere else or de-install/re-install mysql. If you don't have valid data in it yet just "rpm -e" all the packages and then "yum install" them and start it up. If there is no config and no data in it yet you might want to manually get rid of the /var/lib/mysql dir inbetween removal/re-install otherwise it might not recreate that table. Notice also when you install with yum there will be some instructions on the screen about initially setting up the root password and other things to get a base setup working. Do what it instructs...
Reply With Quote
  #5  
Old 17th September 2006, 02:34 AM
wdingus Offline
Registered User
 
Join Date: Aug 2005
Location: Kingsport, TN
Posts: 117
Oh, and it's possible you've simply not created the initial host/user/other tables. The script "mysql_install_db" does this.
Reply With Quote
  #6  
Old 17th September 2006, 05:06 AM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
I'm at another location.
You've given me much to think about and once I'm back at the machine in question I'll try and follow your instructions.
Obviously you're speaking from a posistion of far more insight to this than me.

Points: that come to mind
(1) #/usr/bin/mysqld_safe --user=root works!
doesn't this mean ? it seem to me that from a level 6 user it works but not from a level 3
(2) /var/lib/mysql contains "mysql" and "test" (but I don't recall seeing some other file's that I've previously seen in there....this might be what you are getting at.)
(3) #mysql -u root -p works!
I previously went in there and setup password for root, and left annonymous records untouched.
(4)[root@pc /]# cd /var/lib/mysql/mysql
[root@pc mysql]# ls -al host*
-rw-rw---- 1 mysql mysql 9416 Mar 21 18:32 host.frm
-rw-rw---- 1 mysql mysql 0 Mar 21 18:32 host.MYD
-rw-rw---- 1 mysql mysql 1024 Mar 21 18:32 host.MYI
I've seen all these files on this system....only question sitting here at home is: were they in that subdirectory... but I'm pretty sure they are... because I seem to remember the double use of the mysql directory name

as to de-install / re-install

If I take this course of action I want to clean house and I'm not sure what I need to do this.

#rpm -qa | (sometool name I can't think of at the moment) mysql
will list all the files that got installed with mysql
#rpm -e <form the output above "filename"> will it remove every last bloody file where ever it is located??
Reply With Quote
  #7  
Old 17th September 2006, 03:07 PM
wdingus Offline
Registered User
 
Join Date: Aug 2005
Location: Kingsport, TN
Posts: 117
I'm almost always at "another location". The servers I manage are all many miles from me. That's what SSH is for, secure remote administrative access to Linux servers... and more. Anyway, sounds like it's not a "missing" file(s) that is your problem, it's permissions. Take for example:

# ls -l /var/lib/mysql/mysql/host.MYI
-rw-rw---- 1 root root 1024 Mar 27 2005 /var/lib/mysql/mysql/host.MYI

If you looked at the file and saw something like that it would mean the file is owned by the root user and the root group. it's (rw-) readable and writable by both the root user and anyone in the root group but (---) not by anyone else on the system. The "mysql" user is in the mysql group. It would have NO access to the file in that scenario. By default the mysql server process fires up as the mysql user, inheriting all the permissions that user has. If you override that to start up the mysql server as the root user, it would have *all* privileges on the system and could read/write any file.

/var/lib/mysql contains "mysql" and "test" but they aren't files, they're subdirectories. Inside the mysql subdirectory are host.frm host.MYD host.MYI and similar files. Each grouping of those represent a MyISAM table in the mysql server. Run the client and "use mysql;" followed by "show tables;" and you'll see 1 table per set of .frm/.MYD/.MYI files in /var/lib/mysql/mysql/ directory.

"grep" is the tool you're remembering, it's in the "top 10" of every Linux admin's "toolbox".

# rpm -e <packagename> will remove all binary files, libraries, etc.. What it will commonly NOT remove is configuration and data files. In other words I can install mysql, tweak /etc/my.cnf to my liking, create some databases and import some data in them and then de-install mysql in this manner. Later I can re-install it either with rpm or yum and all my data is still there. (of course I'd back it all up just in case). Anyway, that's why I recommended if you do the de-install/re-install to manually delete the /var/lib/mysql directory as it's likely the rpm -e will not get rid of it. I doubt you need to do that though, a simple "chown -R mysql:mysql /var/lib/mysql" will probably fix you right up.

PS. I'm in the habit of almost always using grep as "grep -i" since that makes it case independent. It would get a "hit" on "mysql" as well as "MySQL" that way.
Reply With Quote
  #8  
Old 17th September 2006, 04:00 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
This is a read out before just delelting /var/lib/mysql/mysql and after running
#/usr/bin/mysqld_safe --user=root &
[
Quote:
root@localhost mysql]# ls -l total 20
drwx------ 2 mysql mysql 4096 Sep 16 18:50 mysql
srwxrwxrwx 1 root root 0 Sep 17 09:48 mysql.sock
drwx------ 2 mysql mysql 4096 Sep 16 11:32 test
Also note that mysql is running because you see mysql.sock in that folder rignt now.

I'm going to post this and then shut down and restart to see if by the remootest chance somethings change "somewhere" in this system that it will install mysql at boot.

I've only got one more week to spend any time trying to get this working or go back and install the FC3 drive that I "do" have everything working on. I'll be back in the state in june 07 maybe then I can make a new system work if not now within the next week

thanks for the insights...hang in here with me!

edit 10:17 CST
same bloody error at boot
060912 16:01:00 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Then I issue the command from a command line and whala it loads up!
[root@localhost craig]# /usr/bin/mysqld_safe --user=root &
[1] 2816
[root@localhost craig]# Starting mysqld daemon with databases from /var/lib/mysql
#ps -aux
Quote:
0.2 4404 1104 pts/1 S 10:08 0:00 /bin/sh /usr/bin/mysqld_safe --user=root
root 2856 0.0 2.0 36276 7700 pts/1 Sl 10:08 0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=root --pid-file=/var/run/mysqld/mysqld.pid --
then why not at boot???????????

Last edited by cwynn; 17th September 2006 at 04:39 PM.
Reply With Quote
  #9  
Old 17th September 2006, 04:30 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
I've also tried
#/etc/rc.d/init.d/msyqd start
thinking maybe this is what sys is using at boot.
It Fails too.. I'm posting it just incase it offers any insights

Quote:
060917 10:21:09 [ERROR] Can't start server : Bind on unix socket: Permission denied
060917 10:21:09 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
060917 10:21:09 [ERROR] Aborting
060917 10:21:09 [Note] /usr/libexec/mysqld: Shutdown complete
060917 10:21:09 mysqld ended
no I don't have aother mysql running when I attempt this .
Reply With Quote
  #10  
Old 17th September 2006, 04:50 PM
wdingus Offline
Registered User
 
Join Date: Aug 2005
Location: Kingsport, TN
Posts: 117
The error is

Quote:
060912 16:01:00 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
What you showed us was a directory listing of /var/lib/mysql/ but NOT the ./mysql/ directory contents inside there. That is where the host.frm and related files exist. The "mysql" and "test" subdirectories are owned by mysql user and have correct permissions but what about the contents of these directories?

You didn't do the chown command as I suggested I suspect...

"chown -R mysql:mysql /var/lib/mysql"

The -R means to do this recursively, all the files and directories inside that directory and all the files and directories from that point down/forward.

I suspect if you did "ls -l /var/lib/mysql/myql/" you'd see some of the host.* files being owned by root and rwx------ permissions, thereby preventing the "mysql" user from accessing them.

Start mysql with "service mysqld start". It's the equivalent of running the /etc/rc.d/init.d scripts by hand but gives the easy ability to query status, restart, etc...

So, do this:

Code:
# service mysqld stop
# ls -l /var/lib/mysql/mysql/host.*
# chown -R mysql:mysql /var/lib/mysql
# service mysqld start
Reply With Quote
  #11  
Old 17th September 2006, 04:57 PM
wdingus Offline
Registered User
 
Join Date: Aug 2005
Location: Kingsport, TN
Posts: 117
Heh, for the heck of it I tried to duplicate your situation and could not. Starting mysql took care of the problem itself.. Odd...
Code:
[root@philco mysql]# pwd
/var/lib/mysql/mysql

[root@philco mysql]# service mysqld stop
Stopping MySQL:                                            [  OK  ]

[root@philco mysql]# chown root:root host*

[root@philco mysql]# ls -al host*
-rw-rw---- 1 root root 9416 Mar 24 11:25 host.frm
-rw-rw---- 1 root root    0 Mar 24 11:25 host.MYD
-rw-rw---- 1 root root 1024 Mar 24 11:25 host.MYI

[root@philco mysql]# service mysqld start
Starting MySQL:                                            [  OK  ]

[root@philco mysql]# ls -al host*
-rw-rw---- 1 mysql mysql 9416 Mar 24 11:25 host.frm
-rw-rw---- 1 mysql mysql    0 Mar 24 11:25 host.MYD
-rw-rw---- 1 mysql mysql 1024 Mar 24 11:25 host.MYI
I changed ownership of the host.* files from the mysql user to the root user and upon starting up mysql, it changed them back.

I hadn't realized this existed in the init script:
Code:
[root@philco mysql]# grep -i chown /etc/rc.d/init.d/mysqld
        chown mysql:mysql "$errlogfile"
            chown -R mysql:mysql "$datadir"
        chown -R mysql:mysql "$datadir"
Reply With Quote
  #12  
Old 17th September 2006, 05:01 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
[root@localhost log]# ls -l /var/lib/mysql/mysql
total 876
-rw-rw---- 1 mysql mysql 8820 Sep 16 11:32 columns_priv.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 columns_priv.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 columns_priv.MYI
-rw-rw---- 1 mysql mysql 9494 Sep 16 11:32 db.frm
-rw-rw---- 1 mysql mysql 876 Sep 16 11:32 db.MYD
-rw-rw---- 1 mysql mysql 4096 Sep 16 11:32 db.MYI
-rw-rw---- 1 mysql mysql 8665 Sep 16 11:32 func.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 func.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 func.MYI
-rw-rw---- 1 mysql mysql 8700 Sep 16 11:32 help_category.frm
-rw-rw---- 1 mysql mysql 20916 Sep 17 09:45 help_category.MYD
-rw-rw---- 1 mysql mysql 3072 Sep 17 09:45 help_category.MYI
-rw-rw---- 1 mysql mysql 8612 Sep 16 11:32 help_keyword.frm
-rw-rw---- 1 mysql mysql 74466 Sep 17 09:45 help_keyword.MYD
-rw-rw---- 1 mysql mysql 15360 Sep 17 09:45 help_keyword.MYI
-rw-rw---- 1 mysql mysql 8630 Sep 16 11:32 help_relation.frm
-rw-rw---- 1 mysql mysql 6516 Sep 17 09:45 help_relation.MYD
-rw-rw---- 1 mysql mysql 12288 Sep 17 09:45 help_relation.MYI
-rw-rw---- 1 mysql mysql 8770 Sep 16 11:32 help_topic.frm
-rw-rw---- 1 mysql mysql 248244 Sep 17 09:45 help_topic.MYD
-rw-rw---- 1 mysql mysql 16384 Sep 17 09:45 help_topic.MYI
-rw-rw---- 1 mysql mysql 9416 Sep 16 11:32 host.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 host.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 host.MYI
-rw-rw---- 1 mysql mysql 9691 Sep 16 11:32 proc.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 proc.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 proc.MYI
-rw-rw---- 1 mysql mysql 8875 Sep 16 11:32 procs_priv.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 procs_priv.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 procs_priv.MYI
-rw-rw---- 1 mysql mysql 8947 Sep 16 11:32 tables_priv.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 tables_priv.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 tables_priv.MYI
-rw-rw---- 1 mysql mysql 8636 Sep 16 11:32 time_zone.frm
-rw-rw---- 1 mysql mysql 8624 Sep 16 11:32 time_zone_leap_second.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 time_zone_leap_second.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 time_zone_leap_second.MYI
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 time_zone.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 time_zone.MYI
-rw-rw---- 1 mysql mysql 8606 Sep 16 11:32 time_zone_name.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 time_zone_name.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 time_zone_name.MYI
-rw-rw---- 1 mysql mysql 8686 Sep 16 11:32 time_zone_transition.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 time_zone_transition.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 time_zone_transition.MYI
-rw-rw---- 1 mysql mysql 8748 Sep 16 11:32 time_zone_transition_type.frm
-rw-rw---- 1 mysql mysql 0 Sep 16 11:32 time_zone_transition_type.MYD
-rw-rw---- 1 mysql mysql 1024 Sep 16 11:32 time_zone_transition_type.MYI
-rw-rw---- 1 mysql mysql 10330 Sep 16 11:32 user.frm
-rw-rw---- 1 mysql mysql 336 Sep 16 13:25 user.MYD
-rw-rw---- 1 mysql mysql 2048 Sep 16 13:35 user.MYI

and I did run it... I should have mentioned this...and included the subdirecitory listing
#chown -R mysql:mysql /var/lib/mysql

I wanted to respond quickly ...I'll do everything in your last reply just incase...

thanks
Reply With Quote
  #13  
Old 17th September 2006, 05:08 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
[root@localhost mysql]# /sbin/service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
Reply With Quote
  #14  
Old 17th September 2006, 05:16 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
[root@localhost mysql]# /usr/bin/mysqld_safe &
[1] 4341
[root@localhost mysql]# Starting mysqld daemon with databases from /var/lib/mysql

# ps -aux
root 4341 0.1 0.2 4400 1100 pts/2 S 11:11 0:00 /bin/sh /usr/bin/mysqld_safe
mysql 4378 0.5 2.0 36280 7796 pts/2 Sl 11:11 0:00 /usr/libexec/mysqld --basedir=/usr --datadir=

[root@localhost mysql]# /sbin/service mysqld stop
STOPPING server from pid file /var/run/mysqld/mysqld.pid
060917 11:11:51 mysqld ended

Stopping MySQL: [ OK ]
[1]+ Done /usr/bin/mysqld_safe
Reply With Quote
  #15  
Old 17th September 2006, 05:58 PM
cwynn Offline
Registered User
 
Join Date: Feb 2004
Location: ND
Age: 70
Posts: 142
[root@localhost mysql]# /usr/sbin/setenforce 0
might have fixed it.... I say might because
I can not believe my eyes
[root@localhost mysql]# /etc/rc.d/init.d/mysqld start
Starting MySQL: [ OK ]
Reply With Quote
Reply

Tags
fails, mysql, start

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql fails to start hdixon Servers & Networking 7 2nd April 2008 04:27 PM
cant start x with init 5, can start x with init 3 after playing with xgl tgm4883 Using Fedora 0 30th August 2006 02:43 AM
init 3 doesn't start Quadraphonic Using Fedora 3 26th May 2006 05:02 PM
mysqld won't start Aardvark Freak Servers & Networking 17 31st May 2005 03:14 AM


Current GMT-time: 00:12 (Monday, 26-06-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat