Python3.4连接MySQL的环境搭建步骤
2016-01-09 10:01
603 查看
一、搭建MySQL和Python
MySQL我使用的版本是:mysql-installer-community-5.7.10.0官方下载地址:http://dev.mysql.com/downloads/file/?id=460361
选择「No thanks,just start my download.」即可下载。
Python下载,略。
Python官网:https://www.python.org/
二、安装Python和MySQL
Pyhton安装,略。MySQL安装一路默认选项即可。
三、下载Python连接MySQL的工具——Connector/Python
官方下载地址:https://dev.mysql.com/downloads/connector/python/我的Python版本是3.4,电脑是64位,所以选择箭头所示的版本下载。
安装Connector
四、测试
测试代码:import mysql.connector cnx = mysql.connector.connect(user='root', password='123456', host='127.0.0.1',database='world') cnx.close()
默认情况下MySQL有一个world数据库,把上面代码拷贝到一个py文件按F5运行,如果没有出错则表示连接成功。
官方网站测试代码网址:http://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html
相关文章推荐
- [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-1433.pth'
- python定时下载FTP指定文件
- 星球大战与 Python 之间的那些事
- python join(), bool(), strip(), dict()
- Python学习-使用matplotlib画动态多图
- 学习了初级的Python
- [俄勒冈大学]养成Python写作习惯
- Python—模块
- python中带星号/一个星号/两个星号的参数
- Python/C API 实用函数(部分)
- python之三层菜单递归
- Python 过滤字符串的技巧,map与itertools.imap
- Python设计模式之抽象工厂模式
- 介绍Python中的文档测试模块
- Python爬虫工程师面试问题总结
- python之super的使用小结
- python设计模式大全
- Python爬虫代理IP池实现方法
- Python实现OpenCV的安装与使用示例
- 关于python的list相关知识(推荐)