LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   MySQL problem - server cannot start (https://www.linuxquestions.org/questions/debian-26/mysql-problem-server-cannot-start-553740/)

duffmckagan 05-14-2007 08:06 AM

MySQL problem - server cannot start
 
The following version is installed on my system:

Code:

mysql-server:
  Installed: 5.0.32-7etch1
  Candidate: 5.0.32-7etch1
  Version table:
 *** 5.0.32-7etch1 0
        500 ftp://ftp.iitm.ac.in stable/main Packages
        100 /var/lib/dpkg/status


After attempting to run "mysqld" it gives the following error:

Code:

070514 18:35:16  InnoDB: Started; log sequence number 0 43655
070514 18:35:16 [Note] Recovering after a crash using /var/log/mysql/mysql-bin
070514 18:35:16 [Note] Starting crash recovery...
070514 18:35:16 [Note] Crash recovery finished.
070514 18:35:16 [ERROR] mysqld: Table './mysql/user' is marked as crashed and should be repaired
070514 18:35:16 [ERROR] mysqld: Table './mysql/user' is marked as crashed and should be repaired
070514 18:35:16 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired

Please help.

PS: Problems started only after I changed testing to etch and did a dist-upgrade

zhjim 05-15-2007 01:49 AM

try something like mysqld --skip-grant to have mysql start without the grant table. At least the server should start now. Then just to a repair of the tables and you should be set.

canegames 05-28-2007 12:13 PM

How do you repair tables? Do you mean grant permision?
 
My Server started fine thanks. But how do I repair the tables. Is it the grant permissions?

zhjim 05-30-2007 04:18 AM

Now start the mysql console with

mysql

then select the database where the broken tables are and do

repair table tablename_to_repair

In your case it would be

use mysql;
repair table user;


If more then one table is broken you could write a php script that loops through all databases then loops through all tables and does a repair.

Pseudo code starts here
Code:

mysql_connect();
$DBs = mysql_query("Show databases");
foreach ($DBs as $DB){
  mysql_query("Use $DB");
  $Tables = mysql_query("Show tables");
  foreach ($Tables as $Table){
    mysql_query("Repair table $Table");
  }
}

Hope that helps. Else just check back and I help you out.

Edit:

By the way a dist-upgrade does a version upgrade to the newest version. Mosttimes this is the unstable developer version. If you just want to keep uptodate do a
apt-get upgrade


All times are GMT -5. The time now is 01:38 AM.