14 lines
261 B
Python
14 lines
261 B
Python
import getpass
|
|
|
|
|
|
def get_mysql():
|
|
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
|