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.

Syntax :

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: