One, connect MySQL
There are two ways of logging in to MySQL:
- Remote host: Mysql-h host address-u user name-p password-p port number
- Native: mysql-h host address-u user name-p password-p port number
If the port number is 3306 (the default port number for MySQL), the-p parameter can be omitted.
The mysql> prompt indicates that the login was successful and entered MySQL's interactive operation mode.
Second, quit the MySQL operator interface
Way One:
Enter quit at the mysql> prompt, which exits the interactive interface:
Way two:
Press ctrl-d at the mysql> prompt to exit the interactive interface
Way three:
Press CTRL-C at the mysql> prompt to exit the interactive interface
Third, the first order
1. Check MySQL version number and current time
2. Arithmetic calculation
3. Specify alias as result
Four, multi-line statements
A command can be divided into multiple lines of input until it appears to be good ";" So far:
Five or one-line multi-command
Separate multiple commands in one line with semicolons
Vi. displaying the currently existing database
Vii. Select a database and display the currently selected database
Select Database
Show current Database
Viii. Cancellation of Orders
When the input command is wrong and cannot be moved (multi-line statement case), you can cancel the command as long as you enter \c before entering the semicolon:
MySQL "Second" basic command