1

I used this command from shell to repair all Databases

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases

and after that I restarted the server

when it came back alive again I tried to open my vBulletin forum but I recived Database error message.

and also tried to open phpMyAdmin but I received this error :

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured).

I checked the services list and found that the MySQL Service is not listed, so I tried to start it from shell I receive this error :

Starting MySQL.Manager of pid-file quit without updating fi[FAILED]

could anyone help me in that ?

thanks in advance.


update

I found these lines in the log file

101101 01:36:01 mysqld started
101101 1:36:01 [Warning] Asked for 196608 thread stack, but got 126976
101101 1:36:01 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and last (automatic?) repair failed
101101 1:36:01 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and last (automatic?) repair failed
101101 1:36:01 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and last (automatic?) repair failed
101101 01:36:01 mysqld ended

What should I do then ?

5 Answers5

3

This occurs when mysqld is not properly shutdown. Basically, the pid file--a file that contains the process id of the currently running process--exists to detect whether or not the process is actively running. When the system is out of whack--i.e., it found the pid but can't find the process, meaning the server was not stopped correctly--it requires manual intervention.

Simply rm /var/run/mysqld.pid and you should be fine.

Andrew

UPDATE: Based on your recent log files (and the fact that automatic repairs failed), here's a great post on additional repair methods. Additionally, make sure you have enough disk space on the server.

Andrew M.
  • 11,182
  • 2
  • 35
  • 29
3

Try starting mysqld with --skip-grant-tables so it won't try to load the (crashed) user table.

/etc/init.d/mysqld start --skip-grant-tables

then log into mysql

mysql

then try the repair command on the user table

use mysql; 
REPAIR TABLE user;

I'm not sure that syntax is 100% correct.

quanta
  • 51,413
  • 19
  • 159
  • 217
Resorath
  • 323
  • 1
  • 3
  • 13
1

I think you need mysqlrepair:

mysqlrepair -r tablename

(Just realized this is the same as mysqlcheck.)

What you need is explicit repair instead of autorepair.

cstamas
  • 6,707
  • 25
  • 42
1

Problem solved :)

Thanks cstamas, Resorath, Andrew & Gennady, thanks all for your help :)

I tried this from shell, and it worked just fine:

service mysql stop 
mkdir /home/tmp
cd /var/lib/mysql
myisamchk --tmpdir=/home/tmp -r */*.MYI
service mysql start
0

I had same problem on xampp, for xampp first go to C:\xampp\mysql\bin\ and start daemon

mysqld --skip-grant-tables --datadir=C:\xampp\mysql\data\

Then open another terminal on same path and run mysqlcheck to find which tables need repair

mysqlcheck mysql -a

After that run mysql and repair the tables

mysql
use mysql; 
REPAIR TABLE table_name;

I hope can fix it without any more issue

Mohsen
  • 129
  • 4