Browse Source

Update Fix credential issue of Mysql

feature/refactor-php
Prabuddha Chakraborty 10 years ago
parent
commit
c9e044c450
  1. 7
      ee/core/mysql.py

7
ee/core/mysql.py

@ -44,8 +44,11 @@ class EEMysql():
def dbConnection(self, db_name): def dbConnection(self, db_name):
try: try:
connection = pymysql.connect(db=db_name, if os.path.exists('/etc/mysql/conf.d/my.cnf'):
read_default_file='/etc/mysql/conf.d/my.cnf') connection = pymysql.connect(db=db_name,read_default_file='/etc/mysql/conf.d/my.cnf')
else:
connection = pymysql.connect(db=db_name,read_default_file='~/.my.cnf')
return connection return connection
except DatabaseError as e: except DatabaseError as e:
if e.args[1] == '#42000Unknown database \'{0}\''.format(db_name): if e.args[1] == '#42000Unknown database \'{0}\''.format(db_name):

Loading…
Cancel
Save