標籤:復原 ase comm 串連 pip 可靠 tom 穩定性 安裝
-
學習目錄
- Python DB-API
- Python操作mysql
- MySQL事務
0x01 Python DB-API
- 引入API模組
- 擷取與資料連線
- 執行SQL語句和預存程序
- 關閉資料庫連接
0x02 Python操作mysql
- MySQLdb用於Python連結MySQl資料庫介面。實現Python資料庫API
- 基於MySQL C API上建立串連
0x03 MySQL事務
- 滿足條件(ACID)
- Atomicity --- 原子性
- Consistency --- 穩定性
- Isolation --- 隔離性
- Durability --- 可靠性
-
Example: mysql基本操作
show databases; # 查看庫use test; # 使用test庫show tables \G; # 查看錶select * from test; # 查看test表資料show create table test; # 查看建表語句select user(); # 查看目前使用者select database(); # 查看當前庫create database test; # 建立庫create table (id int, name char(12), adress char(20))commit; # 提交 rollback; # 復原至上一次提交的位置show variables like "%auto%" # 顯示是否自動認可, on開啟 off關閉insert into test (time, name, id) values (‘20180506‘, ‘anChow‘, ‘25‘) # 插入欄位 desc test; # 查看錶結構grant all privileges on *.* to ‘anChow‘@‘%‘ identified by ‘123456‘ with grant option; # 授權超級使用者
Python基礎之MySQL