Demo of the actual MySQL database operation process

Source: Internet
Author: User

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

 
 
  1. MySQL (the best combination with PHP)> show databases;

Create a database

1. Of course, the database name "asb" cannot already exist)

 
 
  1. MySQL (the best combination with PHP)> create database asb;

2. Select a database as the MySQL database for the current operation.

 
 
  1. 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:

 
 
  1. +------------+  
  2. | database() |  
  3. +------------+  
  4. | asb |  
  5. +------------+  
  6. 1 row in set (0.00 sec) 

The above content is an introduction to MySQL database operations. I hope you will have some gains.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.