Create a sql file From raw mysql files

I copied the raw MySQL files of my website from the database directory because my phpmyadmin does not work. How can i create a sql or csv file from all the db files and then import them into my older server's phpMyadmin?



Never do such "backups".

You will need exact same version (or very similar) of mysql server that created files.

Install MySQL server and copy your files into folder under data directory (while mysql not running yet or stop it first).

Then start server and check log.If no fatal error inside, you win.

Also, if tables are created by InnoDB engine, you will need transaction logs files also. Maybe you will not able to restore it correctly at all.

For next time, best way to do such thing and avoid doing some magic is to use mysqldump.


let's say your username is dbuser and your password is dbpass and your database is called mydb.Then you can create full solid backup by issuing following command from server where mysql is running:

mysqldump -udbuser -pdbpass mydb > /path/to/new/backupfile.sql

after this you can import sql file into other mysql server by issuing following command:

mysql -udbuser -pdbpass mydb <  /path/to/new/backupfile.sql

Some detailed article on this here

Also take a look here :

Some further reading:

Need Your Help

Computing small time differences in Singapore adds 30 minutes when converted to hh:mm:ss.mmm

perl timezone timezone-offset

I have this Perl script where I need to monitor the execution time of DBI calls.