Database Management for MySql learning, mysql learning database

Source: Internet
Author: User

Database Management for MySql learning, mysql learning database

To learn mysql Data step by step, you must first manage mysql Data.

1. Create a database

Command Format: create database [if not exists] database_name.

In actual use, [] is not required. Note that exists is followed by s. For example, on my mysql console, enter the following command:

Create database if not exists usp;

If the feedback is correct, a statement is directly returned as follows:

Query OK, 1 row affected.

 

2. display the databases in mysql

Command Format: show databases

In actual use, pay attention to the s following databases.

Show datbases;

The interface will return:

-----------------------------------

| Database |

-----------------------------------

| Information_schema |

| Mysql |

| Perfermance_schema |

| Test |

| Usp |

----------------------------------

3. Select a working database

Command Format: USE databasename;

This command changes the current scope.

 

4. delete a database

Command Format: drop database if exists datbasename;

When using this command, pay attention to the exists command.

Note that the command drop is not delete.

Drop databse if exists usp;

The interface returns: query OK.

 

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.