A regular review
1. [^}]* is not 0 or more of the symbol }
2. <html>hello world </html> regular writing (?P<tag>\w+)>(.*)</(?P=tag)>
3. Non-greedy matching .*?
4. Match subtitles [a-zA-Z] match numbers \d
5. The difference between ^[] and [^]
2. Database MySQL
1. Python's DB-API provides an interface for most databases. The usage process is: ①Introduce the API module; ②Get the connection to the database; ③Execute SQL statements and stored procedures; ④Close the database connection.
2. Python 3 install MySQL database software: use pip install pymysql
3. MySQL things:
Transactions must meet 4 conditions (ACID): Atomicity (atomicity), Consistency (stability), Isolation (isolation), Durability (reliability).
① Transaction atomicity: A set of transactions, either successful or withdrawn. For example, if 200 things are processed at a time, if one fails, the task will be withdrawn.
②Stability: If there is illegal data (foreign key constraints, etc.), the transaction is withdrawn.
③Isolation: Transactions run independently. If the result of a transaction affects other transactions, then other transactions will be withdrawn. 100% isolation of transactions at the expense of speed
④Reliability: After the software and hardware crash, the InnoDB data table driver will use the log file to reconstruct and modify. Reliability and high speed cannot have both, the innodb_flush_log_at_trx_commit option determines when to save transactions to the log.
4. Recommended MySQL plug-in: easy to connect to various databases.
5. Authorize superuser with grant option
例如grant all privileges on *.* to 'tangnanbing'@'%' identified by '1qaz@WSX' with grant option
6. View the library show datebase
7. Check which libraries are there show datebases
8. View the tables of a library use db;show tables \G;
9. View the field desc tb of the table;
View the table creation statement show create table tb;
which user is currently select user();
Current library select database();
Create database create database db1;
create table create table t1 (id int, name char(40) adress varchar(30));
View database version select version();
View mysql status show status;
Modify mysql parameters show variables like 'max_connect%'; set global max_connect_errors = 1000;
View mysql queue show processlist;
10. Create a common user and authorize grant all on *.* to databases1.user1 identified by '123456';
grant all on db1.* to 'user2'@'10.0.2.100' identified by '111222';
grant all on db1.* to 'user3'@'%' identified by '231222';insert into tb1 (id,name) values(1,'aming');
11、更改密码UPDATE mysql.user SET password=PASSWORD("newpwd") WHERE user='username' ;
12、查询 select count(*) from mysql.user; select * from mysql.db;
select * from mysql.db where host like '10.0.%';
13、插入 update db1.t1 set name='aaa' where id=1;
Empty table truncate table db1.t1;
drop table drop table db1.t1;
drop database drop database db1;
repair table repair table tb1 [use frm];
14. View permissions show grants for root@'localhost';
3. MySQL connection (and common parameters)