1.安装Mysql
添加环境变量
新建:
PATH
配置my.ini
CMD:mysqld --initialize-insecure --console
net start mysql
2.安装navicat
https://navicat.com.cn/download/direct-download?product=navicat_premium_cs_x64.exe&location=1
mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.06 sec)
pip install pymysql
3.Python与sql的连接
import pymysql
conn=pymysql.connect( host='localhost',user='root',password='123456')
mysql='create database mytest'
conn.query(mysql)
mport pymysql
conn=pymysql.connect( host='localhost',user='root',password='123456')
mysql='create database mytest3'
conn.query(mysql)
mysql='insert into novel values("打豆豆",34,8)'
conn.query(mysql)
conn.commit