Using mysqlimport where the filename is different from the table name

11,909

You didn't say what platform you are on. On unix you can create a symbolic link to the file:

ln -s filename.txt tablename.txt

Then use that in the mysqlimport command.

But mysqlimport is just a command line interface to LOAD INFILE so you could also do this on the command line:

mysql -e "load data infile 'filename' into table TBL_NAME" dbname
Share:
11,909

Related videos on Youtube

Mike Q
Author by

Mike Q

Updated on April 19, 2022

Comments

  • Mike Q
    Mike Q about 2 years

    I've been playing with mysqlimport and I've run into the restriction where the filename has to be the same as the table name. Is there any way to work round this?

    I can't rename the file as it is used by other processes and I don't want to copy the file as there will be many of them, some being very large.

    I want to use mysqlimport not LOAD INFILE.

    EDIT: Unfortunately this needs to run on windows so no tricks with symbolic links I'm afraid.

    • baptx
      baptx over 6 years
      mysqlimport should allow a parameter to set a different table name, this is a basic feature...
  • John Hunt
    John Hunt about 9 years
    you can still use mysql on windows with the same syntax.. symlinking the files is a bit of a weird way of doing it.