Create README; Set-Up Streamline
This commit is contained in:
22
get_mysql.py
22
get_mysql.py
@ -1,4 +1,5 @@
|
||||
import getpass
|
||||
import sys
|
||||
|
||||
|
||||
def get_mysql():
|
||||
@ -6,12 +7,15 @@ def get_mysql():
|
||||
Extrahiert die MySQL-Anmeldedaten aus ~/.my.cnf . \n
|
||||
Funktioniert wahrscheinlich nur auf Linux, vor allem für den Server gedacht.
|
||||
"""
|
||||
u = getpass.getuser()
|
||||
f = open("/home/"+u+"/.my.cnf", "r")
|
||||
i = f.read()
|
||||
u = i.find("user=")
|
||||
p = i.find("password=")
|
||||
u = i[u+5:p-1]
|
||||
ro = i.find("[clientreadonly]")
|
||||
p = i[p+9:ro-2]
|
||||
return u, p
|
||||
if sys.platform == "linux":
|
||||
u = getpass.getuser()
|
||||
f = open("/home/"+u+"/.my.cnf", "r")
|
||||
i = f.read()
|
||||
u = i.find("user=")
|
||||
p = i.find("password=")
|
||||
u = i[u+5:p-1]
|
||||
ro = i.find("[clientreadonly]")
|
||||
p = i[p+9:ro-2]
|
||||
return u, p
|
||||
else:
|
||||
return "paulmrtn", "LQAlnY9YNXSJHBG5:9Ls"
|
||||
|
||||
Reference in New Issue
Block a user