create database 'name' charset utf8
創(chuàng)建一個(gè)數(shù)據(jù)庫(kù)并設(shè)置字符集是utf8
create database if not exists 'name'
如果不存在就創(chuàng)建,存在就忽略
show databases
顯示已存在的所有數(shù)據(jù)庫(kù)
show databases like 'db_%'
查看數(shù)據(jù)庫(kù)名字以db_開頭的數(shù)據(jù)庫(kù)
use 'database_name'
選擇數(shù)據(jù)庫(kù)
alter database 'database_name' default charset gbk default collate gbk_chinses_ci
修改數(shù)據(jù)庫(kù)字符集
drop database if exists 'database_name'
如果存在就刪除數(shù)據(jù)庫(kù),不存在就忽略
show engines
顯示所有引擎
MySQL數(shù)據(jù)類型
數(shù)值類型:int
日期時(shí)間類型:date
字符串類型:varchar
浮點(diǎn)類型:float