mysql數據庫學習——2,數據庫的選定,創建,刪除和變更 數據庫選定,數據庫選定後依然可以使用其他數據庫中的數據表,只要指定【數據庫.數據表】即可
use db_name select * from db_name.tbl_name
顯示所有數據庫
mysql> select schema_name from information_schema.schemata; +--------------------+ | schema_name | +--------------------+ | information_schema | | feng | | mysql | +--------------------+ 3 rows in set (0.11 sec)
顯示屬於數據庫feng的表
mysql> select table_name from information_schema.tables where table_schema='feng'; +------------+ | table_name | +------------+ | feng | +------------+ 1 row in set (0.05 sec)
數據庫創建
create database db_name create database db_name if not exists db_name create database db_name if not exists db_name character set utf8 collate utf8_icelandic_ci show create database db_name\G
數據庫刪除
drop database db_name drop database db_name if not exists db_name
數據庫修改
alter database db_name default character set utf8 default collate utf8_general_ci