MySQL Tutorial/Introduction/Command
Содержание
A simple multiple-line statement.
mysql>
mysql> SELECT
-> USER()
-> ,
-> CURRENT_DATE;
+----------------+--------------+
| USER() | CURRENT_DATE |
+----------------+--------------+
| root@localhost | 2007-07-22 |
+----------------+--------------+
1 row in set (0.00 sec)
mysql>
Prompts and their meaning
Prompt Meaning mysql> Ready for new command. -> Waiting for next line of multiple-line command. "> Waiting for a single quote (") in the next line. "> Waiting for double quote (") in the next line. `> Waiting for a backtick (`) in the next line. /*> Waiting for /* in the next line.
The Most Important mysql Commands
Abbreviation Command Interpretation \c clear terminates input of command. \h help displays a list of commands. \q exit or quit ends mysql. \s status shows status information on the MySQL server. \T [f] tee [filename] logs all input and output into the specified file. \t notee ends tee. The logging can be resumed at any time with tee or \T. \u db use database makes the specified database the default. \. fn source filename executes the SQL commands contained in the given file. The commands must be separated by semicolons.
To cancel the command: type the "\c" command
mysql>
mysql>
mysql> CREATE TABLE employee (
-> ID IN(3)
-> \c
mysql>
mysql>
You can enter multiple statements on a single line and end each one with a semicolon:
mysql>
mysql> SELECT VERSION(); SELECT NOW();
+---------------------+
| VERSION() |
+---------------------+
| 5.0.41-community-nt |
+---------------------+
1 row in set (0.00 sec)
+---------------------+
| NOW() |
+---------------------+
| 2007-07-22 20:10:16 |
+---------------------+
1 row in set (0.00 sec)
mysql>