Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, 15 January 2015

Restore MySQL database from MyISAM tables

It is assumed that you have a back up copy of MyISAM tables (.frm,.myd,.myi)

Each MyISAM table is stored on disk in three seperate files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension.

Steps:

1) Stop running instance of MySQL Server.
2) Copy database folder containing frm,MYI and MYD files from your backup to  MySQL data directory - e.g. /var/lib/mysql
3) Change the permission of the folders to mysql.mysql so that mysql instance can read the files/directories.
4) If required, please check and repair all database tables using 'myisamchk'.

Note- While restoring the database, use the same MySQL server version.

Tuesday, 13 January 2015

Fixing "Unknown table engine 'InnoDB'" error

In case, you encounter an the following error after tweaking your MySQL configuration:

 Unknown table engine 'InnoDB'

The fix is simple. Do the following:

$ sudo service mysql stop
$ sudo rm /var/lib/mysql/ib_logfile*
$ sudo service mysql start

There is no harm in deleting files - ib_logfile* as the files are re-created once the database starts up.