MySQL database location
John Hunter
jdhunter at nitace.bsd.uchicago.edu
Mon Jun 17 10:55:12 EDT 2002
>>>>> "Pawel" == Pawel Lewicki <lewy0lewy at poczta.onet.pl> writes:
Pawel> Hi, Is is possible to get the physical path to the MySQL
Pawel> database file using MySQLdb or any other pythonous way?
Depending on your platform, you could parse /etc/my.cnf.
for line in open('/etc/my.cnf').readlines():
if line.find('datadir=')==0:
dataDir = line[8:-1]
print dataDir
More information about the Python-list
mailing list