Learning Directory
- Python Db-api
- Python operation MySQL
- MySQL Transaction
0x01 Python Db-api
- Introducing API Modules
- Getting a connection to a data
- Execute SQL statements and stored procedures
- To close a database connection
0x02 python operation MySQL
- MySQLdb for Python link MySQL database interface. Implementing the Python Database API
- Establishing a connection based on the MySQL C API
- Install MySQL Dependency package
0x03 MySQL Transaction
- Meet condition (ACID)
- ---atomicity of atomicity
- Consistency---stability
- ---Isolation of isolation
- Durability---Reliability
Example:mysql Basic Operation
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 basics of MySQL