Use the MYSQL command to direct import and export SQL files

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Most of the time, Data development we will be used a lot of development tool, Such as PowerDesigner, Navicat etc. these software, Although easy to use, But the charges, In the company there is the prohibition of the use of pirated software, If the penalty, So we can't directly in the machine is provided, the cracked version, This time, If we want to import or export SQL statements do, Although there are free software such as the existence of mysql-workbench, But not good ah, Troublesome operation, To say., Personally feel that the remember password and username IP address these convenient., Of course, in fact it is very powerful.

Okay, hark back to the subject, in fact, the most simple method, import and export, is the direct use of MySQL commands to the SQL statement. Although online a lot, but the feeling is not too clear, describes the format of what ah, ugly death, so here to organize their own, then write a hair up.

Export to SQL file in 1.MYSQL database

Is actually very simple, is a statement, first we open the CMD, do not enter the MySQL command interface, directly according to the following format will derive the statement out into, and then enter the password to the:

Mysqldump -h[host IP] -u[-p [username] to export the database]> path //[file [derived].sql]

Well, that may look a bit abstract, to give you an example, now has a database bookinfodb my MYSQL, now I want to export it and saved to the D disk.

This time we go to the D disk directory, we can see more of a bookinfodb.sql file.

2 import data into the MYSQL from the SQL file

1>First of all, we should enter the MySQL command interface in CMD, the format is simple, is the MySQL -u[name] -h[host address, the default is localhost] -p not to write and input the password

2>The use of CREATE database DATRABSE [name] to create a database, and then use the use [database name] choose a database to use

3>The SQL file import path //*.sql] source [where

Then output a series of Query OK of such information.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Lou at November 23, 2013 - 9:17 AM