西安音乐学院杨林,草率的爆破,万恩利
Aaron使用的操作系统为macOS Sierra 10.13.2
基本的python语法都已经学完,现在从mysql连接数据库开始学习
1 PATH=$PATH:/usr/local/mysql/bin
随后别忘了执行以下语句非常重要,这条语句只要是执行了vim ~/.bash_profile后必须需要执行
1 source ~/.bash_profile
之后执行以下语句进行python和mysql的连接
1 pip install mysql-connector-python
1 import mysql.connector as MySQLdb 2 3 conn = MySQLdb.Connect( 4 host = '127.0.0.1', 5 port = 3306, 6 user = 'root', 7 passwd = 'l23456', 8 db = 'test', 9 charset = 'utf8' 10 ) 11 12 cursor = conn.cursor() 13 print (conn) 14 print (cursor) 15 16 cursor.close() 17 conn.close()
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python爬虫:Request Payload和Form Data的简单区别说明
浅谈Python中threading join和setDaemon用法及区别说明
Python3-异步进程回调函数(callback())介绍
python继承threading.Thread实现有返回值的子类实例
Python中使用threading.Event协调线程的运行详解
网友评论