Copying data files is NOT a reliable way to backup a database. The “best” way is use mysqldump. Then we get everything. But in such case if you forget to take dump folder just
Steps:
- Stop the MySQL server
- Go to old xampp/myql/data folder.
- Remove any existing ibdata and ib_logfile files.
- Go to New xampp/myql/data folder.
- Place old ibdata files only. Don’t place ib_logfile files.
- Start the server.
It will create new ib_logfile(s) as required. Now check your database working enjoy….. ?
Mysql Backup and Restore
- To backup all mysql databases:
For Linux/Fedora/Ubuntu
mysqldump -u username -p –all-databases > filename.sqlFor windows
c:\xampp\mysql\bin>mysqldump -u root -p < filename.sql
- To restore all databases:
For Linux/Fedora/Ubuntu
mysql -u username -p < filename.sql
For windows
c:\xampp\mysql\bin>mysqldump -u root -p < ../../filename.sql
- Single Database
Backup mysqldump -u root -p password databasename > filename.sql
Restore mysql – u username -p password databasename < filename.sql
If your database already exists and try to restore it, try following line:
mysqlimport -u username -p password databasename filename.sql