How To Copy The Mysql Database

Table of contents:

How To Copy The Mysql Database
How To Copy The Mysql Database

Video: How To Copy The Mysql Database

Video: How To Copy The Mysql Database
Video: How to copy or duplicate a database using MySQL Workbench 6.3 CE 2024, April
Anonim

For all custom MySQL database operations, it is best to use the free phpMyAdmin application. It can be downloaded from the manufacturer's website and installed both locally and on a remote server. If you use the control panel of your hosting provider, then you do not need to install it, since most hosters have this application installed by default.

How to copy the mysql database
How to copy the mysql database

Instructions

Step 1

Use the table export function to get the contents of the source database as SQL statements. To do this, after loading the phpMyAdmin interface and logging into the SQL server that stores the source database, go to it by clicking the corresponding link in the left frame. Then click on the "Export" link in the right frame.

Step 2

Click on the "Select all" link located above the list of tables of this database in the "Export" section of the right frame of the application interface. In the "Parameters" section, all settings can be left in the form in which phpMyAdmin sets them by default. If the amount of data stored by the tables of this database is very large, then it is better to use files for transfer - check the box next to the "Save as file" message. Without this mark, the application will place the exported data in a multi-line text field, from which it can be simply copied and then pasted into the corresponding field on the target SQL server. Click the "OK" button, and the program will compose and send the necessary requests, and then either offer to save the file with the exported data, or display them in the appropriate field on the next loaded page.

Step 3

Log in to a similar phpMyAdmin interface on the SQL server where you want to place the portable database. Do this in a new browser tab if the data is supposed to be transferred using the "copy / paste" method. Enter the name of the database in the "New Database" field and click the "Create" button. The program will send a request, after which the server will create an empty database with the specified name, inform the application about this, and it will open the page with an empty database.

Step 4

Use the import function to create copies of the original tables and the data stored in them in this database, if the transfer is using files. By clicking on the "Import" tab in the right frame, you will open a form in which you need to click the "Browse" button, find the file created when exporting the data, and then click the "OK" button. The application will upload the instructions contained in the file to the server, and after they are executed, it will update the pages, displaying a list of created tables in the left frame, and more detailed information about them in the right frame.

Step 5

Instead of the previous step, click on the SQL tab if you are migrating without using intermediate files. Then switch to the browser tab where you have a form with the exported data SQL statements open, select and copy them. Switching back, paste everything you copied into the field under the words "Execute SQL query (s) to the database" and click "OK". The application will send requests to the server, which will create tables, fill them with data and return a report on the results. PhpMyAdmin will show you this report and update the content of the now no longer empty database.

Recommended: