連接服務(wù)器
mysql -u [username] -p [password];
查看服務(wù)器里所有的數(shù)據(jù)庫(kù)
show databases;
選擇數(shù)據(jù)庫(kù)
use [databaseName];
查看庫(kù)下面所有的表
show tables;
創(chuàng)建數(shù)據(jù)庫(kù)
create database [databaseName] (charset 字符集);
刪除數(shù)據(jù)庫(kù)
drop database [databaseName];
創(chuàng)建表
creat table tableName(
屬性名 屬性類(lèi)型
旷余。母市。屹电。
);
刪除表
drop table [tableName];
更改表名
rename table [oldName] to [newName];
清除表數(shù)據(jù)
truncate [tableName];(刪除一個(gè)表再創(chuàng)建一個(gè)新的)