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