Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] MYSQL won't restart after a power failure
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mlnzigzag
n00b
n00b


Joined: 19 May 2009
Posts: 58

PostPosted: Mon Jul 27, 2009 11:31 am    Post subject: [SOLVED] MYSQL won't restart after a power failure Reply with quote

Hi ppl,

i got a very strange issue with my mysql installation, started after the server had a power loss and an unclean shutdown

the root filesystem has already been checked with e2fsck that found and corrected a lot of errors, but the server still doesn't start.

following is the output of the shell

i even tried starting the server with a newly initialized database, but nothing changes

i tried to reemerge (recompiling) as well as reinstalling the package with --usepkgonly but the following is still printed out to the shell


Code:
host1 ~ # /etc/init.d/mysql start
dbg:  >>> start()
 * Starting mysql ...
dbg:  >>> get_slot_config()
dbg:  srv                0
dbg:  srv_slot           0
dbg:  srv_num           
dbg:  tmp_eval           mysql_slot_0[@]
dbg:  conf_d_parameters 
dbg:  MY_SUFFIX         
dbg:  chroot dir =>
dbg:  niceness   =>
dbg:  basedir    => /usr
dbg:  datadir    => /var/lib/mysql
dbg:  pidfile    => /var/run/mysqld/mysqld.pid
dbg:  socket     => /var/run/mysqld/mysqld.sock
dbg:  Unamanged  => 
dbg:  <<< get_slot_config() ok
dbg:  >>> checkconfig("/var/lib/mysql")
dbg:  <<< checkconfig() ok
 * Starting mysql (/etc/mysql/my.cnf)
dbg:  starting mysqld with: --defaults-file=/etc/mysql/my.cnf   --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock
Starting /usr/sbin/mysqld...
Detaching to start /usr/sbin/mysqld...done.
dbg: 
dbg: 
 * MySQL NOT started (1)
dbg:  <<< start()


these are the mysqld.err lines relative to this attempt to start the server:
Code:
090727 12:21:04 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=mysqld-bin' to avoid this problem.
090727 12:21:04 [ERROR] Can't start server : Bind on unix socket: Permission denied
090727 12:21:04 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
090727 12:21:04 [ERROR] Aborting

090727 12:21:04 [Note] /usr/sbin/mysqld: Shutdown complete


no need to say that i DON'T have another mysqld server running on this socket (wich doesn't exists)

Please feel free to ask for any further informations i may be lacking!

Thanks a lot in advance for your patience and help

Marco


Last edited by mlnzigzag on Mon Jul 27, 2009 1:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Mon Jul 27, 2009 1:13 pm    Post subject: Reply with quote

Try this:

Code:

chown -R mysql:mysql /var/run/mysqld


then try starting up mysql.
Back to top
View user's profile Send private message
mlnzigzag
n00b
n00b


Joined: 19 May 2009
Posts: 58

PostPosted: Mon Jul 27, 2009 1:20 pm    Post subject: Reply with quote

tnx a lot mate, we did it!

i just did as you said and it instantly came up

just wonderin why the unclean shutdown created this issue...
but it's much less important than having the service back running

thank you very much

Marco
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Mon Jul 27, 2009 1:31 pm    Post subject: Reply with quote

permissions issue

the .sock file likely had a different owner (presumably root)
so mysql was unable to remove it and recreate it when attempting to do so as the 'mysql' user. This is something it will do on every startup.

If the .sock is owned by mysql, it isnt a problem, because mysql has permissions to nuke the .sock and recreate it - and it will do this happily upon starting up, as it assumes the presence of an orphaned .sock means an unclean shutdown that should prompt it to nuke the .sock and recreate.

Of course when nit can't nuke and recreate, it bombs out.

a blind guess - perhaps there was a setuid operation in progress that never completed? dunno, again jsut a blind guess
Back to top
View user's profile Send private message
mlnzigzag
n00b
n00b


Joined: 19 May 2009
Posts: 58

PostPosted: Mon Jul 27, 2009 3:57 pm    Post subject: Reply with quote

I'm not so sure the problem is totally fixed.

i found the webserver returning the following error in mysql-php-related pages
Code:

Warning: preg_match() [function.preg-match]: Internal pcre_fullinfo() error -3 in /var/www/localhost/htdocs/medicomd/mainfile.php on line 39

Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/medicomd/mainfile.php:39) in /var/www/localhost/htdocs/medicomd/mainfile.php on line 178
non connesso


Please check it out and tell me if you have some hints!


Marco
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Mon Jul 27, 2009 4:56 pm    Post subject: Reply with quote

you might see if you can connect to the DB from the command line, do a few basic queries, etc

if it's genuinely hosed, mysqlcheck/myisamchk will be your friend
Back to top
View user's profile Send private message
mlnzigzag
n00b
n00b


Joined: 19 May 2009
Posts: 58

PostPosted: Tue Jul 28, 2009 8:45 am    Post subject: Reply with quote

standard queries returned some errors, so i've run:
Code:

mysqlcheck -uroot -p --all-databases

and it returned many errors, most of the tables had to be repaired

then i've run
Code:

mysqlcheck -uroot -p --auto-repair --all-databases

and *ALL* the tables with errors have been repaired, the box printed out a list of


NAME_OF_TABLE1 ......OK
NAME_OF_TABLE2 ......OK
ETC..

Anyway, right now, if i connect to the mysql instance using Mysql Administrator i can't see all the tables in the catalog;

i just see the ones (actually three) that had no errors in it.

Could you please tell me how to let the server re-read all the tables?

I even tried to restart the service, but it didn't make it.

Thanks a lot for your replies

Marco
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum