shell> MySQL--user=user_name--password=your_password db_name
shell> MySQL--help
shell> mysql-?
Options
--protocol={tcp | sockets | PIPE | MEMORY}
MySQL command
Some commands MySQL can explain themselves. To view these commands, enter Help or \h at the mysql> prompt
The default mysql> can be reconfigured, how to configure which methods?
1. Using Environment variables
Shell> Export mysql_ps1= "(\[email protected]\h) [\d]>"
2. Use the options file my.cnf
[MySQL]
prompt= (\\[email protected]\\h) [\\d]>\\_
Or
prompt= "\\r:\\m:\\s>"
3. Using command-line options
shell> MySQL--prompt= "(\[email protected]\h) [\d]>"
4. Interactive, you can change the prompt interactively using the prompt (or \ r) command.
Mysql>prompt (\[email protected]\h) [\d]>\_
Mysql>prompt
How do I execute an SQL statement from a text file?
1. shell> MySQL db_name < test.sql-p
2. mysql > Source filename
MySQL > \. FileName
Using the--safe-updates option, how do I safely execute the update and DELETE statements?
shell> MySQL--safe-updates--select_limit=500--max_join_size=10000
MySQL Command line tool