Created
May 15, 2019 20:05
-
-
Save eagleEggs/e00cce52907d3eafdd54ad3177ceb257 to your computer and use it in GitHub Desktop.
quick python mySQL DB test
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 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