#3 python 访问mysql
##3.1
准备pymysql库
pip3 install PyMySQL 或者 pip install pymysql 或者 sudo pip3 install PyMySQL
如果没有pip3命令,请执行sudo apt-get install -y python3-pip
如果没有pip命令, 请执行sudo apt install python-pip
##3.2
通过python3.7命令行访问mysql
import pymysql
db = pymysql.connect("centos7a","root","123456","pythontest" )
cursor = db.cursor()
cursor.execute("DROP TABLE IF EXISTS EMPLOYEE")
测试成功,可以成功删除表
##3.3
在ideas白那些py文件访问mysql
```python
#!/usr/bin/python3.7
import pymysql
# 打开数据库连接
db = pymysql.connect("centos7a","root","123456","pythontest" )
# 使用 cursor() 方法创建一个游标对象 cursorlocatte
cursor = db.cursor()
# 使用 execute() 方法执行 SQL,如果表存在则删除
cur