1、MYSQl的安裝
www.mysql.com
分為社區(qū)版本和商業(yè)版本,商業(yè)版本增加了更多優(yōu)化功能,特別是Enterprise monitor
安裝完成之后會(huì)出現(xiàn)一個(gè)彈窗,務(wù)必記錄下來,因?yàn)槟鞘请S機(jī)生成的初始密碼,第一次登錄的時(shí)候需要那個(gè)初始密碼,并且進(jìn)入mysql之后第一件事情就是修改初始密碼
2、MYSQL的環(huán)境
前期可以不下載workbench,因?yàn)閣indows的dos,以及MAC的終端,完全可以完成mysql的操作和練習(xí)
3、MYSQL的簡(jiǎn)單代碼
(1)創(chuàng)建/刪除/查詢/選擇數(shù)據(jù)庫(kù)
create database (name);
drop database (name);
show databases;
use (data name);
(2)創(chuàng)建/刪除/查詢表格(在已經(jīng)選擇了數(shù)據(jù)庫(kù)的情況下)
create table name (列的名字,數(shù)據(jù)類型(顯示字符數(shù))),(列的名字,數(shù)據(jù)類型(顯示字符數(shù))),(列的名字,數(shù)據(jù)類型(顯示字符數(shù))),(列的名字,數(shù)據(jù)類型(顯示字符數(shù)));
drop table (name);
show tables;
(3)查詢數(shù)據(jù)表結(jié)構(gòu)
desc (table name);
查詢創(chuàng)建數(shù)據(jù)表的命令?
show create table (table name)\G;
(\G 表示清理掉那些亂碼,可以去掉\G試試,記住務(wù)必是大寫)
(4)在表格中插入數(shù)據(jù),單數(shù)據(jù):
insert into (table name) set 列的名字=*,列2的名字=*;
多數(shù)據(jù),即數(shù)組插入數(shù)據(jù)(數(shù)組根據(jù)多少列)
insert into (table name) values (數(shù)據(jù)1,數(shù)據(jù)2,數(shù)據(jù)3);