I have a mysqldump of all databases, including mysql
.
I'm using mysql 5.6 on Windows 2008 R2. How can I restore my backup ?
The problem is that I cannot start the server when the database mysql
is missing.
Edit:
This is what happened exactly:
I got this error while running some query:
[ERROR] Out of memory; check if mysqld or some other process uses all
available memory; if not, you may have to use 'ulimit' to allow mysqld
to use more memory or you can add more swap space
I tried to restart mysqld
, but it did not restart because of this error in the log:
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 2568.
InnoDB: You may have to recover from a backup.
Best Answer
my.ini
according to the doc http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html:innodb_force_recovery = 1
The server started
mysqldump
mysqlcheck --all-databases
and found the offending table.mysql -u ... -p... -e "drop database ..."
). I deleted the depending tables, but with no luck,mysqld
still refused to start withinnodb_force_recovery = 0
I decided to start off from scratch to be sure to get a clean database back.
mysqld --initialize
, according to https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.htmlI copied the two system database files from the backup (directories
mysql
andperformance_schema
)Now the server started again with these warnings in the log:
the same for
mysql/slave_relay_log_info
andmysql/slave_worker_info
mysql/slave_master_info.frm
,mysql/slave_relay_log_info.frm
andmysql/slave_worker_info.frm
mysql
database.At this point I got a working mysql server with a clean database. The olny thing that remained was to import the dumps that I made previously, using
mysql -u root -p... mydb < backup-mysql\mydb.sql
And thank God, after one hour of interruption, everything was working again.