MySQL database build, view, modify, delete

Source: Internet
Author: User

I. Creating a Database

# # #语法:
# # #create database or CREATE schema

# # #create Database or schema if not EXISTS DB name
###[Specifies the default value]character set sets the character set GBK Simplified Chinese UTF8 Universal Code BIG5 Traditional Chinese
###[Specifies the default value]collate proofing name rules Utf8_bin

# # # #数据库名的限制 cannot be the same name can begin with any letter-number-underscore _-$, but cannot use numbers alone.
# # # #不能使用MySQL的关键字, Windows case insensitive, Linux sensitive, improve portability, all lowercase

Two. View the database
# # #语法
# # #show databases or schemas
# # #like ' mode ' where condition; The like option, which specifies the match pattern where optional options are used to specify the scope criteria for the query

SHOW DATABASES; #显示所有的数据库

SHOW SCHEMAS; #显示所有的数据库

SHOW DATABASES like ' db_% '; #查询只有以db_开头的数据库名

Three. Select a database

# # # #当我们使用MySQL command line client We need to explicitly select a database using the use character and then operate on the database
# # #use Database name
Use DB_TEXT1;

Four. Modify the database
# # #语法
# # #alter Database or schema name
# # #character Set Character Set
# # #collater Proofing Set rules
ALTER DATABASE Db_text1
CHARACTER SET GBK
COLLATE Gbk_chinese_ci;

Five. Deleting a database

# # #语法
# # #drop Database or schema if exists DB name

DROP DATABASE IF EXISTS db_text2;

MySQL database build, view, modify, delete

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.