MySQL command line options.

shabbir's Avatar author of MySQL command line options.
This is an article on MySQL command line options. in MySQL.

-?, --help, -I
Display help.
Enable automatic rehashing. Disable with --disable-auto-rehash.
-A, --no-auto-rehash
No automatic rehashing.
WARNING: options deprecated; use --disable-auto-rehash instead.
-B, --batch
Don't use history file. Disable interactive behavior.
Directory where character sets are.
Set the default character set.
-C, --compress
Use compression in server/client protocol.
-#, --debug[=#]
This is a non-debug version. Catch this and exit
-D, --database=name
Database to use.
Delimiter to be used.
-e, --execute=name
Execute command and quit.
-E, --vertical
Print the output of a query (rows) vertically.
-f, --force
Continue even if we get an sql error.
-g, --no-named-commands
Named commands are disabled.
WARNING: option deprecated; use --disable-named-commands instead.
-G, --named-commands
Enable named commands.
-i, --ignore-spaces
Ignore space after function names.
-b, --no-beep
Turn off beep on error.
-h, --host=name
Connect to host.
-H, --html
Produce HTML output.
-X, --xml
Produce XML output
Write line numbers for errors.
-L, --skip-line-numbers
Don't write line number for errors.
WARNING: -L is deprecated, use long version of this option instead.
Disable outfile.
WARNING: option deprecated; use --disable-tee instead
-n, --unbuffered
Flush buffer after each query.
Write column names in results.
-N, --skip-column-names
Don't write column names in results.
WARNING: -N is deprecated, use long version of this options instead.
-O, --set-variable=name
Change the value of a variable. Please note that this
WARNING: option is deprecated;
-o, --one-database
Only update the default database.
-p, --password[=name]
Password to use when connecting to server.
-W, --pipe
Use named pipes to connect to server.
-P, --port=#
Port number to use for connection.
Set the mysql prompt to this value.
The protocol of connection (tcp,socket,pipe,memory).
-q, --quick
Don't cache result, print it row by row.
-r, --raw
Write fields without conversion. Used with --batch.
Reconnect if the connection is lost. Disable with --disable-reconnect.
-s, --silent
Be more silent. Print results with a tab as separator, each row on new line.
Base name of shared memory.
-S, --socket=name
Socket file to use for connection.
-t, --table
Output in table format.
-T, --debug-info
Print some debug info at exit.
Append everything into outfile.
-u, --user=name
User for login if not current user.
-U, --safe-updates, --i-am-a-dummy
Only allow UPDATE and DELETE that uses keys.
-v, --verbose
Write more. (-v -v -v gives the table output format).
-V, --version
Output version information and exit.
-w, --wait
Wait and retry if connection is down.
Number of seconds before connection timeout.
Max packet length to send to, or receive from server
Buffer for TCP/IP and socket communication
Automatic limit for SELECT when using --safe-updates
Automatic limit for rows in a join when using --safe-updates
Refuse client connecting to server if it uses old protocol
Print the program argument list and exit
Don't read default options from any options file
Only read default options from the given file #
Read this file after the global files are read
jonw66 like this
pradeep's Avatar, Join Date: Apr 2005
Team Leader
What does --disable-auto-rehash do??
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Originally Posted by pradeep
What does --disable-auto-rehash do??
It disables the hasing of the data when some insert/update occurs on a table.
Bhullarz's Avatar
Skilled contributor
I am trying to pass the query using file named "Test.sql" which contains the following commands:
select now(),version(),user();
and command I am using in mysql client:
I'm using MYsql Server 5.0.
Can somebody help me to rectify this error.I tried above mentioned command related to infile and outfile but ech command is giving error.
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Try this,
mysql -u Username -pPassword < c:\test.sql
Bhullarz's Avatar
Skilled contributor
sir I tried this. But it is not working. Error is as under:

outfile disabled.
error 1064 (42000) : You have an errorin your SQL syntax; check the manual that corresponds to your MySQl server version for the right syntax to use near 'mysql<c:est.sql' at line 1

This is the exact wording.
Ajay12's Avatar, Join Date: May 2012
Go4Expert Member
Sir can send me the manual for 'mysql 5.5'