First of all I should clarify why am I exporting data from MySQL and putting it in PHPMyAdmin. Well, I had a lot of data stored in MySQL on my Windows(hope Microsoft does no sue me for using the word “Windows” :P) box and I wanted to use all that data in a project which I wanted to on LAMP (Linux/Apache/MySQL/PHP). So now I had to move all that data from MySQL into a dump file on the Crash(Windows :P) Box and import it into PHPMyAdmin on my Linux box.
EXPORT DATA FROM MYSQL :-
There’s a program called “mysqldump” that gets installed when we install MySQL. This mysqldump tool is used to out all the data from the database into a dump file.
Major confusion that occurs is, that we try to execute this program from MySQL prompt. When we do that, it returns an error. The error statement says that there is an error in the syntax and refer the MySQL version manual for the correct syntax.
We need to execute the mysqldump program from the Command Prompt instead of the MySQL prompt.
mysqldump -a -u=username -p database_name > name_of_the_dumpfile.sql
Once you hit enter it asks for password and creates the dumpfile.
IMPORT DATA INTO PHPMYADMIN :-
After logging into the PHPMyAdmin, select the database in which you want to import the data.
After selecting the database, you’ll see an Import tab on the top, click on it. In the import panel specify the path of the dump file and say GO. It’s done, all the data is imported into PHPMyAdmin.