Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eagleEggs/e00cce52907d3eafdd54ad3177ceb257 to your computer and use it in GitHub Desktop.
Save eagleEggs/e00cce52907d3eafdd54ad3177ceb257 to your computer and use it in GitHub Desktop.
quick python mySQL DB test
import mysql.connector
class Database(object):
def __init__(self, username, dbhost, database, password, databaseport):
self.username = username
self.database = database
self.password = password
self.dbhost = dbhost
self.databaseport = databaseport
self.database = mysql.connector.connect(user=str(self.username),
database=str(self.database),
passwd=str(self.password),
port=str(self.databaseport),
host=str(self.dbhost))
self.myCursor = self.database.cursor(buffered=True)
print("Connected")
x = Database("", "127.0.0.1", "", "", "3306")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment