It has been a long time since my last post but I have been pretty busy, sorry for that 🙂
Recently, I felt the need to export my MySQL database from one development machine and import it into another along with my PHP code. No need to mention copying the code since that is the easiest task. Copying your DB is also a simple one, but I wanted to mention it in this post for the beginners.
First, you need to export your database from the first machine so that you can import it in your second machine. Here are the steps:
Launch your phpMyAdmin instance
Click the database that you want to export (on the DBs tree on the left) and click Export button on the top
A window for export settings will open. For the beginners, you can use “Quick” settings with SQL format and just hit the “Go” button below
This will export an SQL query as a .sql file which will be used to create your database tables and fill them with your existing data. You will be importing this .sql file from the second machine.
Now go to your second machine
Click “New” on the databases tree on the left (see below)
Give a name to your database (I suggest you give the same name as in your first machine)
Select a collation (use the same collation as in the database on your first machine)
After creating your brand new empty database click it on the DB tree on the left, and click “Import” button on the top
On the window that opens you will see a section as below. Click “Choose File” and select your exported .sql file
You don’t need to change any settings if you have used the default settings while exporting the file. Now just hit “Go”. You will see a success message and your newly created tables will immediately be available in the DB tree view on the left. If you click your tables you will see that your existing data also has been filled in on your new database.
Hope this helps.