啟動(dòng)數(shù)據(jù)庫
sudo service mysql start
mysql -u root
第一行啟動(dòng)數(shù)據(jù)庫泻拦,第二行用戶名為root密碼為空
在打開的mysql>
下輸入
create database mysite ;
創(chuàng)建一個(gè)數(shù)據(jù)庫
show databases;
顯示數(shù)據(jù)庫列表
use <數(shù)據(jù)庫名>
連接數(shù)據(jù)庫
select version();
顯示數(shù)據(jù)庫版本
create table <表名> ( <字段名1> <類型1> [,..<字段名n> <類型n>]);
創(chuàng)建表
desc 表名
獲取表名
drop table <表名>
刪除表
insert into <表名> values(1,'Tom',96.45),(2,'Joan',82.99), (2,'Wang', 96.59);
插入數(shù)據(jù)
select * from <表>
查詢表
delete from 表名 where 表達(dá)式
刪除表