How do I connect to a My. SQL Database in Python Setting. You must install a My. SQL driver before doing anything. Unlike PHP, only the SQLite driver is installed by default with Python. The most used package to do so is My. SQLdb but its hard to install it using easyinstall. For Windows user, you can get an exe of My. SQLdb. For Linux, this is a casual package python mysqldb. You can use sudo apt get install python mysqldb for debian based distros, yum install My. SQL python for rpm based, or dnf install python mysql for modern fedora distro in command line to download. For Mac, you can install My. SQLdb using Macport. Usage. After installing, reboot. This is not mandatory, but will prevent me from answering 3 or 4 other questions in this post if something goes wrong. So please reboot. Then it is just like using another package usrbinpython. My. SQLdb. connecthostlocalhost, your host, usually localhost.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |