tar 解包的指令
tar xvf 封包件名稱
tar 打包的指令
tar cvf 要打包的檔案名稱
rpm解除安裝指令
rpm -e 包名稱
rpm -e 包名稱 --nodeps 強行解除安裝,不檢查包的依賴關系
rpm安裝包指令
rpm -ivh 包名稱
1、首先作業系統的字元集為utf8
檢視作業系統字元集指令
locale
2、建立資料庫的時候使用character set utf8;指定字元集為utf8
3、設定mysql client字元集
set names utf8;
4、crt設定為utf8
sql語言當中字元串用單引号。
查詢年齡大于21歲的同學
select * from table1 where age > 21;
查詢c++班所有同學
select * from table1 where class = 'c++班';
查詢c++班所有同學并且年齡大于22
select * from table1 where class = 'c++班' and age > 22;
查詢所有姓王的同學
select * from table1 where name like '王%';
windows中加入path環境變量
c:\mysql\lib;c:\mysql\bin
mysql端口号3306,要在linux中将3306端口加入到防火牆的信任端口清單中
distinct代表過濾重複的值
聚合函數往往是與group by字句配合使用的
查找蒼老師班裡面年齡最大同學的名字
select a.name from table1 a, table3 b where a.class = b.class and b.teacher = '蒼老師'
and a.age = (select max(c.age) from table1 c, table3 d where c.class = d.class and d.teacher = '蒼
老師');
在select語句中where查詢用到哪個字段,這個字段就必須建立索引
唯一索引的查詢效率高于普通索引
建立表的時候primary key (id))語句相當于為id字段建立了一個唯一索引
登陸
mysql -u root -p
登入遠端mysql server的方式
mysql -h ip位址 -u 使用者名 -p
使用資料庫
use db1;
設定字元集
檢視表結構
desc table1;
插入資料:
insert into table1 (name, sex, age, class) values ('張三', '男', 24, '0802班');
查詢資料:
select * from table1;
執行sql腳本
source my.sql
--my.sql-------------------