First, start/close MySQL
(1) Start MySQL service:net start MySQL
(2) Stop MySQL service: net stop MySQL
Second, login/exit MySQL
First we take a look at some important MySQL parameters, the following table lists some of the important MySQL parameters:
(1) View version number : Enter Mysql-v or MySQL--version, note that here is the uppercase-V.
(2) Login MySQL
MySQL to add parameters after the line. The format is: mysql-u root (user)-p-p port number-H MySQL host name \ip (Local machine loopback address).
such as input: Mysql-u root-p-P 3306-h 127.0.0.1, enter password login after entering;
If the command line is the native of MySQL, and with the default port of 3306, enter directly: Mysql-u root-p, and then enter the password.
(3) MySQL exit
Enter any of the following to exit the MySQL service.
Mysql> exit;
Mysql> quit;
Mysql> \q (note here is a backslash);
Here I three all tried, can quit the MySQL service, the following screenshot is entered: exit;
Third, modify the MySQL prompt
Let's take a look at the prompts we often use:
Before you modify, take a look at the default MySQL prompt:
(1) specifying by parameter when connecting to the client
The format is: Mysql-u root-p--prompt prompt, for example, we enter: Mysql-u root-p--prompt \h
(2) After connecting to the client, through the prompt command to modify
The format is: Mysql>prompt prompt, for example we enter: Mysql>prompt \u, then enter again: Prompt \u@\h \d>
Let's start by using the command to enter a database to see the results, input: use test;
Four, MySQL common commands
(1) display the current server version : SELECT version ();
(2) display the current date time: SELECT now ();
(3) display the current user : SELECT user ();
Five, the MySQL statement specification
(1) Keywords and function names are all capitalized (even if written in lowercase, but for distinction, the recommended keyword and function names are all uppercase).
(2) Database name, table name, field name all lowercase.
(3) The SQL statement must end with a semicolon.
The above is the entire content of this article, I hope to help you learn.
Related articles:
MySQL Learn the first day of contact with MySQL first time
MySQL Learn the next day install and configure MySQL Winx64
MySQL learning the third day under Windows 64-bit operating system to authenticate MySQL
Thank you for your reading, small knitting will make unremitting efforts!