I have been trying to use MySQL in a Python project I've been working on. I downloaded the connector: mysql-connector-python-2.1.3-py3.4-winx64
here.
I already had Python 3.5.1 installed. When I tried to install the connector, it didn't work because it required python 2.7 instead. I have searched on many sites, even on StackOverflow I couldn't find a solution.
Thanks for any help.
MySQL server will provide all the services required for handling your database. Once the server is up and running, you can connect your Python application with it using MySQL Connector/Python.
I am using Python 3.5.2 on window 8 pro 64-bit and the following procedure is worked for me.
Download driver (PyMySQL-0.7.9.tar.gz (md5)) from here
Extract and copy the folder pymysql into the python Lib folder e.g (C:\Users\MyUsername\AppData\Local\Programs\Python\Python35-32\Lib)
#!/usr/bin/env python import pymysql conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='sandbox') cur = conn.cursor() cur.execute("SELECT * FROM users") print(cur.description) print() for row in cur: print(row) cur.close() conn.close()
I hope it will work for you as well. Happy coding :)
Try this link: MySQL - Downloads - Connector - Python
From Select Platform
, select the platform independent
an download MySQLconnector.
After extracting the file go to its directory where setup.py is located.
WINDOWS: press shift + right_click and open command windows and type:
python setup.py install`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With