ADD mysql_connect.py
parent
56ad8924e0
commit
7e024b1748
|
|
@ -0,0 +1,19 @@
|
||||||
|
import mysql.connector
|
||||||
|
|
||||||
|
mydb = mysql.connector.connect(
|
||||||
|
host="172.17.1.21",
|
||||||
|
user="root",
|
||||||
|
password="N53yBCswuawzBzS445VNAhWVMs3N59Gb9szEsrzXRBzarDqpdETpQeyt5v5CGe",
|
||||||
|
database="Stines-GmbH"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_ip(query):
|
||||||
|
cursor = mydb.cursor()
|
||||||
|
cursor.execute(query)
|
||||||
|
return cursor.fetchall()
|
||||||
|
|
||||||
|
def get_database():
|
||||||
|
cursor = mydb.cursor()
|
||||||
|
cursor.execute('SHOW DATABASES')
|
||||||
|
return cursor
|
||||||
Loading…
Reference in New Issue