MySQL command line options.

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

-?, --help, -I
Display help.
--auto-rehash
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.
--character-sets-dir=name
Directory where character sets are.
--default-character-set=name
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=name
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.
--local-infile
Enable/disable LOAD DATA LOCAL INFILE.
-b, --no-beep
Turn off beep on error.
-h, --host=name
Connect to host.
-H, --html
Produce HTML output.
-X, --xml
Produce XML output
--line-numbers
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.
--no-tee
Disable outfile.
WARNING: option deprecated; use --disable-tee instead
-n, --unbuffered
Flush buffer after each query.
--column-names
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;
--sigint-ignore
Ignore SIGINT (CTRL-C)
-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.
--prompt=name
Set the mysql prompt to this value.
--protocol=name
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
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.
--shared-memory-base-name=name
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.
--tee=name
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.
--connect_timeout=#
Number of seconds before connection timeout.
--max_allowed_packet=#
Max packet length to send to, or receive from server
--net_buffer_length=#
Buffer for TCP/IP and socket communication
--select_limit=#
Automatic limit for SELECT when using --safe-updates
--max_join_size=#
Automatic limit for rows in a join when using --safe-updates
--secure-auth
Refuse client connecting to server if it uses old protocol
--print-defaults
Print the program argument list and exit
--no-defaults
Don't read default options from any options file
--defaults-file=#
Only read default options from the given file #
--defaults-extra-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
Quote:
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:
mysql<c:\test.sql;
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,
Code:
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'