What are some frequently used mysqlimport options while uploading the data into MySQL table through command line?


mysqlimport can be run with a number of options. Followings are some options for mysqlimport and their effect on import.

Option
Action
-r or –replace
Cause imported rows to overwrite existing rows if they have the same unique key value.
-i or –ignore
Ignore rows that have the same unique key value as existing rows.
-f or –force
Force mysqlimport to continue inserting data even if errors are encountered.
-l or --lock-tables
Lock each table before importing (a good option on a busy server).
-d or –delete
Empty the table before inserting.
--fields-terminated- by='char'
Specify the separator used between values of the same row, default \t (tab).
--fields-enclosed- by='char'
Specify the delimiter that encloses each field; default is none.
--fields-optionally- enclosed-by='char'
Same as --fields-enclosed-by, but delimiter is used only to enclose string-type columns; default is none.
--fields-escaped- by='char'
Specify the escape character placed before special characters; default is \ (backslash, which if specified would be '\').
--lines-terminated-by='char'
Specify the separator used to terminate each row of data; default is
(newline).
-u or –user
Specify your username; default is Unix login name.
-p or –password
Specify your password.
-h or –host
Import into MySQL on the named host; default is localhost.
-s or –silent
Silent mode; output appears only when errors occur.
-v or –verbose
Verbose mode, print more commentary.
-L or local
Name a local file on the client.
-V or –version
Print program version information and exit.
-? or –help
Print help message and exit.

Updated on: 27-Feb-2020

93 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements