MySql bulk load command line tool

后端 未结 4 1893
借酒劲吻你
借酒劲吻你 2020-11-30 07:28

Does MySql have a bulk load command line tool like bcp for SQLServer and sqlldr for Oracle? I know there\'s a SQL command LOAD INFILE or similar but I sometime

相关标签:
4条回答
  • 2020-11-30 07:35

    mysqlimport.

    takes the same connection parameters as the mysql command line shell. Make sure to use the -L flag to use a file on the local file system, otherwise it will (strangely) assume the file is on the server.

    There is also an analogous variant to the load data infile command, i.e., load data local infile, according to which the file will be loaded from the client rather than the server, which may accomplish what you want to do.

    0 讨论(0)
  • 2020-11-30 07:40
    mysql -u root -p
    use database;
    source /path/yourfile.sql
    

    Might be what you are looking for, you can use rsync via ssh to transfert the 'bulk file' from a machine to another.

    0 讨论(0)
  • 2020-11-30 07:45

    I'm think mysqlimport may help?

    Loads tables from text files in various formats. The base name of the text file must be the name of the table that should be used. If one uses sockets to connect to the MySQL server, the server will open and read the text file directly. In other cases the client will open the text file. The SQL command 'LOAD DATA INFILE' is used to import the rows.

    0 讨论(0)
  • 2020-11-30 07:51
    LOAD DATA LOCAL INFILE 'C:\\path\\to\\windows\\file.CSV'
    INTO TABLE table_name
    FIELDS TERMINATED BY ','
    LINES TERMINATED BY '\n'
    (field1, field2, field3, fieldx);
    
    0 讨论(0)
提交回复
热议问题