Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am having a problem with my database it does not want to start :(

the server is running on linux centos 6.2

it was working until I emptied the logs I don't know if this have anything to do with my problem !

the log says the following :

131212 15:52:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
131212 15:52:06  InnoDB: Initializing buffer pool, size = 8.0M
131212 15:52:06  InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
131212 15:52:06  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
131212 15:52:06  InnoDB: Started; log sequence number 2 2565027428
131212 15:52:06 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find     file: 'db' (errno: 2)
131212 15:52:06 mysqld_safe mysqld from pid file /var/run/mysqld/ ended


here is my "my.cnf" :


# Disabling symbolic-links is recommended to prevent assorted security risks


also this is the output of ls -l /var/lib/mysql/ :

-rwxr-xr-x 1 mysql mysql 1512046592 Dec 12 17:02 ibdata1
-rwxr-xr-x 1 mysql mysql    5242880 Dec 12 17:19 ib_logfile0
-rwxr-xr-x 1 mysql mysql    5242880 Dec 11 09:54 ib_logfile1
drwxr-xr-x 2 mysql mysql       4096 Dec 12 09:02 mysql
drwxr-xr-x 2 mysql mysql      12288 Dec 12 17:15 nagios
drwxr-xr-x 2 mysql mysql      20480 Dec  9 09:05 nagiosql
drwxr-xr-x 2 mysql mysql       4096 Oct 27 10:45 test

any suggestions?

share|improve this question
The ur-problem seems to be that: "Can't find file: 'db'". It seems your InnoDB is damaged. You need recovery. – peterh Dec 12 '13 at 16:49
ok thanks but how can I do this recovery? – Ahmad Hajjar Dec 12 '13 at 17:01
What is your datadir ? Goto that folder in Linux, and run ls -l and post that output. Also, please post your /etc/my.cnf in the question as well. – RolandoMySQLDBA Dec 12 '13 at 17:20
You mentioned you emptied the logs. What exactly did you empty? Did you delete the ib_logfile0 and ib_logfile1 files? – RolandoMySQLDBA Dec 12 '13 at 17:33
@RolandoMySQLDBA I put them in the question :) – Ahmad Hajjar Dec 12 '13 at 17:34

1 Answer 1

up vote 0 down vote accepted

I was able to solve this problem by doing the following :

  1. Move all the contents of my data directory (in my case /var/lib/mysql/ ) to a safe place.
  2. Execute the command service mysqld start, this will:
    • recreate two DBs:
      • mysql
      • test
    • recreate ibdata1, ib_logfile0, and ib_logfile0
  3. Copy the contents that you backed up (in step 1) from the safe place to the data directory again, of course, except both mysql and test directories.
  4. Using the following command mysqladmin -u root -p'' password yournewpass reset the password of your root user.

An Advice:

Always make sure you make a backup of your databases structure and data to avoid looping in such loops, just delete every thing, re-install your engine, and restore your data :)

share|improve this answer
Your luck was your tables are MyISAM :) – Maxime FOUILLEUL Dec 16 '13 at 9:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.