This article mainly introduces the actual operations of the MySQL database, including how to query statements correctly and how to perform the correct operation steps for creating a database, the following is a detailed description of the article. I hope you will gain some benefits after browsing it.
MySQL database operations:
Note that the displayed results of all examples are the results of the following steps in order.
Query statement
1. view the MySQL database version number and the current date of the server MySQL (the best combination with PHP)> select version (), current_date; Operation Method 1)
MySQL (best combination with PHP)> select version ()
->, Current_date; Operation Method 2)
※Operation statements are separated by commas (,) and separated by commas (;). The operation ends. line breaks do not affect the operation process.
2. view all databases on the server
- MySQL (the best combination with PHP)> show databases;
Create a database
1. Of course, the database name "asb" cannot already exist)
- MySQL (the best combination with PHP)> create database asb;
2. Select a database as the MySQL database for the current operation.
- MySQL (best combination with PHP)> use asb;
After the selection is successful, the following information is displayed:
Database changed
You can even directly select the MySQL database to be operated when logging on to the MySQL (the best combination with PHP) database by using window commands. The premise is that the asb database exists)
Bin> MySQL (best combination with PHP) asb-u uesername-p
Enter password :******
3. view the name of the currently operated MySQL database
MySQL (the best combination with PHP)> select database ();
The result is as follows:
- +------------+
- | database() |
- +------------+
- | asb |
- +------------+
- 1 row in set (0.00 sec)
The above content is an introduction to MySQL database operations. I hope you will have some gains.