How do I export and import a mysql db using PHPMyAdmin?

Step 1:


Open phpMyAdmin and select the database from where you want to export data and/or structure. Go to the tab with "Export". Select the table(s) you want to save.

 

Select the option you need: Data only or data and structure or structure only:

--> if you only want to update a table on another server, which has a table with the same structure, then you choose data only

--> if you want to create a new table on another server (for instance, if you have a development environment and you now want to put your application in production) then choose structure only

--> if you are moving a complete table, choose data and structure Select "save as file" Hit "go" You can now enter a filename and specify where the file needs to be saved. It's recommended to choose a meaningful filename that includes the date. Like "shop_05_07_03.sql" This creates the dumpfile. If you open it in notepad or any other texteditor, it looks something like:

# phpMyAdmin MySQL-Dump # version 2.4.0 # http://www.phpmyadmin.net/ (download page) # # Host: thehostname would be here # Generation Time: Apr 04, 2004 at 02:39 PM # Server version: 4.0.13 # PHP Version: 4.2.3 # Database : `db-name would be here` # -------------------------------------------------------- # # Table structure for table `test` # CREATE TABLE test ( siteID int(6) NOT NULL auto_increment, uname tinytext NOT NULL, upwd tinytext NOT NULL, nick tinytext NOT NULL, sitename text NOT NULL, regdate date NOT NULL default '9999-01-01', numtrial int(7) unsigned NOT NULL default '0', PRIMARY KEY (siteID) ) TYPE=MyISAM COMMENT='Table with userinfo'; # # Dumping data for table `useradmin` # INSERT INTO test VALUES (1, 'mytest', 'testt', 'myteste', 'www.mysite.com/site/test.html', '0000-00-00', 0);

This is the dumpfile for table 'test' that contains one record. As you can see, it's just a series of sql statements to recreate the table and insert all records.

 

Step 2:

 


If necessary, can can upload this file to a server or move it to another PC (on a disk or whatever)

 

 

Step 3:

 


Open phpMyAdmin. Select the database you want to import the table(s) in. Go to the SQL tab. Look at the bottom for "Or location of the textfile" and browse to the dumpfile. Doubleclick on it so that the fileadress appears in the textbox. Then hit "go" All sql-statement will be executed and you will get a notification after the file is processed.

  • 1 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

Can I backup my MySQL database? How do I backup my database?

You can backup your database two ways. 1. Click on Backup in Cpanel then click on the database...

Can I connect to MySQL remotely?

Yes, you can connect to your MySQL database remotely using a client such as MySQL-Front at...

Can I use MySQL Front to access my database?

You can remotely connect to your database by using your domain name as the host you are...

Does your MySQL server support extended character sets, foreign character sets, and collation sets?

In the control panel's left-hand side of the page, there should be a MySQL version for your...

How do I create a database in MySQL?

You can create a database via your control panel by clicking on the mySQL icon. When you create...