Created
March 6, 2017 10:20
-
-
Save m7shapan/cfcdb5e84af7ff9ff0f3fb9b5484a14e to your computer and use it in GitHub Desktop.
connect to MySql DB python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
import MySQLdb.cursors | |
sql_db = MySQLdb.connect(host="",user="",passwd="",db="",cursorclass=MySQLdb.cursors.DictCursor) | |
cursor = sql_db.cursor() | |
domainsCount = cursor.execute("SELECT * FROM domains where ...") | |
print cursor.fetchall() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment