Mysql database learning-2. database selection, creation, deletion, and change

Source: Internet
Author: User

Mysql database learning-2: database selection, creation, deletion, and change database selection. After the database is selected, you can still use the data tables in other databases by specifying [database. Data Table ].

use db_nameselect * from db_name.tbl_name

 

Show all databases
mysql> select schema_name from information_schema.schemata;+--------------------+| schema_name        |+--------------------+| information_schema || feng               || mysql              |+--------------------+3 rows in set (0.11 sec)

 

Display tables of the database feng
mysql> select table_name from information_schema.tables where table_schema='feng';+------------+| table_name |+------------+| feng       |+------------+1 row in set (0.05 sec)

 

Database creation
create database db_namecreate  database db_name if not exists db_namecreate  database db_name if not exists db_name  character set utf8 collate utf8_icelandic_cishow create database db_name\G

 

Delete Database
drop database db_namedrop database db_name if not exists db_name

 

Database Modification
alter database db_name default character set  utf8                                          default collate  utf8_general_ci

 


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.