Diewuxi

Belive tomorrow will be better, love science and technology, support communication and understanding, always ready for thought turn.

Blog / engineering_technology / computer / software / server / mysql / MySQL 数据导入导出

Blog


Article^ Parent

MySQL 数据导入导出


Date: 2015-07-15 00:00:00
Description: MySQL 数据导入导出。
Keywords: MySQL, 导入, 导出
Category: engineering_technology/computer/software/server/mysql
Tag: mysql
Link: https://www.diewuxi.com/blog/article/60.html

导出数据:

SELECT `done`, `class`, `title`, `item`, `date`, `time`, `deadline` FROM `thing`
    WHERE `id` >= '154' AND `id` <= '159'
    INTO OUTFILE '/tmp/somerecord'
    FIELDS TERMINATED BY ',' ENCLOSED BY '''
    LINES TERMINATED BY '\n';
                        

导出数据库:

mysqldump -u root -p richengdb thing > '/tmp/thing.sql'
                        

导入数据:

LOAD DATA LOCAL INFILE '/tmp/somerecord' INTO TABLE `thing`
    FIELDS TERMINATED BY ',' ENCLOSED BY '''
    LINES TERMINATED BY '\n'
    (`done`, `class`, `title`, `item`, `date`, `time`, `deadline`);
                        

导入数据库:

mysql -u root -p richengdb < '/tmp/thing.sql'
                        

Last modified: 2015-07-15

Comments [0]

There is no comments now.

Write comment(* is necessary, and email is not shown to public)


Diewuxi 2017--2024