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/mysqld.pid ended
Edit
here is my "my.cnf" :
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
max_connections=1500
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
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?
Best Answer
I was able to solve this problem by doing the following :
/var/lib/mysql/
) to a safe place.service mysqld start
, this will:mysql
test
ibdata1
,ib_logfile0
, andib_logfile0
mysql
andtest
directories.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 :)