在介绍python在数据库中的操作之前先简单介绍点mysql中的操作语言:
[root@elk-server 2018-01-24]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 194 Server version: 5.6.16 Source distribution Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databses; mysql> create table users(id int(2) not null primary key auto_increment,username varchar(40),password mysql > desc users; mysql > select * from users; mysql > insert into users(username,password,email) values("tiantian","tiange1003","tiantianml@outlook. mysql > insert into users(username,password,email) values("zhiping","zhiping","785298065@qq.com"); mysql > select * from users;