MySQL Import txt data and export the entire database or a table of the database method

Source: Internet
Author: User
Tags mysql command line mysql export database mysql import

MySQL Import txt data

Cases:

Create Schema Foursquare_nyc;use foursquare_nyc;create table checkins (userid int not null auto_increment, originid VA Rchar (+), LocationID varchar (+), x double, y double, primary key (UserID)), load data local infile "E:/dataset_ubi Comp2013_raw_checkins.txt "into Table Checkins (originid,locationid,x,y);

By default, \ n is delimited for each set of data, and \ t is delimited for each data, and if not, the

Load data local infile "e:/dataset_ubicomp2013_raw_checkins.txt" into Table Checkins (originid,locationid,x,y) fields Terminated by ' * * * ' lines terminated by ' * * *;

1) The file can use an absolute path such as ' c:/d.txt ', otherwise put the file in the database root directory.

2) Because Windows lines are ' \ r \ n ' separated, they must be lines terminated by ' \ r \ n ',

If you do not set this parameter, you can also import the success, but will import a "\ r" control character, may not be visible in the visual MySQL tool field, but the MySQL command line display will be obvious confusion.


MySQL export database is. sql

Cases:

Command line E:\Program files\mysql\mysql Server 5.5\bin>mysqldump-u root-p database name > generate file name. sql


The table for the MySQL export database is. sql

Cases:

Command line E:\Program files\mysql\mysql Server 5.5\bin>mysqldump-u root-p database name Table name > generate file name. sql


MySQL Import txt data and export the entire database or a table of the database method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.