Microsoft Certifications Practice Tests:   Exam 70-506   Exam 77-881   Exam 70-583   Exam 70-642   Exam 77-882   Exam 70-680   
windows 8
 


ForumArticlesMicrosoft ExamsWindows 8 ArticlesWindows 8 NewsProduct Reviews



Resources » Microsoft Software » MS SQL Server


How to import and export data in MySQL


Posted Date:     Category: MS SQL Server    
Author: Member Level: Gold    
Rating: 2 out of 52 out of 5Points: 15 (Rs 20)


In this article, I explain you how to import and export data in mysql.


Importing and Exporting


The System Management Databases such as MySQL can handle easily and with great flexibility a very large volume of data. However, MySQL is also robust, it may be interesting to recover all the data contained in our database data to a backup (backup) or simply to switch to another database. Called "export" is to format a file (called dump) all information necessary to create a database identical.

Conversely, the import is called to create a DBMS in a new database from an export file (dump).

MySQL offers a number of tools to export its database to other DBMS or to import them.

Export MySQL database


MySQL provides several ways to export data. The key is the command line mysql to achieve almost any action on the databases it contains from a single command line:
mysql-h host-u user-ppass dbname> fichier_dump
The following notation is also possible:
mysql - host host - user user - passwordpass dbname> fichier_dump

  • represents the host name or IP address of the machine where the database you want to export is installed. By default it is localhost, that is to say the machine from which the command mysql is launched

  • user represents the user with whom you want to connect. By default it is the user root

  • password is the password of the user that you want to connect. If you do not specify a password, one will be asked interactively. There must be no space between-p and the password provided, unlike other fields

  • dbname is the name of the database to export.

  • fichier_dump is the name of the file where the database will be exported. If absolute path is not specified, the file is stored in the same directory that the command mysql. Be careful not to assign a name to an existing file in this directory!



Export a MySQL database with mysqldump


The command mysql to export an entire database hosted by MySQL efficiently but does not provide the flexibility necessary for exporting multiple databases or otherwise part of the basis of data (table or part of a table). The command mysqldump meets this need by providing the ability to specify more precisely the data to export. The syntax for this command:
mysqldump [options] dbname [tables]
Here are the options generally used:
mysqldump-h host-u user-ppass-RFILE dbname [tables]

  • host represents the name or IP address of the machine where the database you want to export is installed. By default it islocalhost, that is to say the machine from which the command mysql is launched

  • user is the user that you want to connect. By default it is the user root

  • password is the password of the user that you want to connect. If you do not specify a password, one will be asked interactively. It should not be any space between-p and the password provided

  • dbname is the name of the database to export.

  • file is the file name where the database will be exported. If absolute path is not specified, the file will be stored in the same directory as the mysql command.



Import a database in MySQL


The command-line mysql can also import data. Simply use the redirect " and indicate the dump file containing SQL statements to import:
mysql-u user-h host-ppass dbname <fichier_dump
The following notation is, once again, also possible:
mysql - host host - use user-passwordpass dbname <fichier_dump

Import a database with phpMyAdmin


To import a database using phpMyAdmin, simply copy-paste the "dump" of MySQL in the field provided to enter the query or click on the button "browse"to get the file containing the copy of base.


Did you like this resource? Share it with your friends and show your love!








Responses to "How to import and export data in MySQL"
Author: tinydonut    02 Jul 2010Member Level: Bronze   Points : 1
before you import/export data, you should add the "default-character-set=utf8" into the my.cnf or my.ini in order to handle different character sets.

In addition, Navicat is the best tool among the about support tools



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)
    Website: We will link to your website, if the comment is worth keeping!



    Type the numbers and letters shown on the left.


    Previous Resource: SQL Server 2008: Saving changes is not permitted
    Return to Resources
    Post New Resource
    Category: MS SQL Server


    Post resources and earn money!
     
    Popular Tags   Tag posting guidelines   Search Tags  
    My sqpl  .  Importing in mysql  .  Mysql export data  .  Import data in sql  .  

    Subscribe to Windows resources by Email


    Awards & Gifts



    Silverlight 4 free practice test is now live!

    My Profile

    Online Membersataul haque
    More...

    Active Members
    TodayLast 7 Daysmore...


    Quick Links:Windows 8 beta
    Windows 8 Installation
    Windows 8 Features
    Google Plus
    Microsoft Office 365
    Microsoft Lync 2010
    Silverlight 5
    HTML 5
    Cloud Computing
    Rupee Symbol
    Internet Explorer 9
    Windows Azure

    RSS Feeds Resource Feeds
    Forum Feeds
    Job Feeds



    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.