Fix MariaDB connections issues
* allow new unix_socket auth system * add socket path in /etc/mysql/conf.d/my.cnf
This commit is contained in:
2
install
2
install
@@ -713,7 +713,7 @@ wo_woconf() {
|
|||||||
echo -e '\n[letsencrypt]\n\nkeylength = "ec-384"' >>/etc/wo/wo.conf
|
echo -e '\n[letsencrypt]\n\nkeylength = "ec-384"' >>/etc/wo/wo.conf
|
||||||
fi
|
fi
|
||||||
if ! grep -q "php" /etc/wo/wo.conf; then
|
if ! grep -q "php" /etc/wo/wo.conf; then
|
||||||
echo -e '\n[php]\n\nversion = 7.3' >>/etc/wo/wo.conf
|
echo -e '\n[php]\n\nversion = 7.4' >>/etc/wo/wo.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
cement==2.10.12
|
cement==2.10.12
|
||||||
pystache>=0.5.4
|
pystache>=0.5.4
|
||||||
pynginxconfig>=0.3.4
|
pynginxconfig>=0.3.4
|
||||||
PyMySQL>=0.10.0
|
PyMySQL>=0.10.1
|
||||||
psutil>=5.7.2
|
psutil>=5.7.2
|
||||||
sh>=1.12.14
|
sh>=1.12.14
|
||||||
SQLAlchemy>=1.3.18
|
SQLAlchemy>=1.3.18
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ def pre_pref(self, apt_packages):
|
|||||||
[client]
|
[client]
|
||||||
user = root
|
user = root
|
||||||
password = {chars}
|
password = {chars}
|
||||||
|
socket = /run/mysqld/mysqld.sock
|
||||||
""".format(chars=chars)
|
""".format(chars=chars)
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read_string(mysql_config)
|
config.read_string(mysql_config)
|
||||||
@@ -939,16 +940,11 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('/etc/mysql/conf.d/my.cnf.tmp')
|
config.read('/etc/mysql/conf.d/my.cnf.tmp')
|
||||||
chars = config['client']['password']
|
chars = config['client']['password']
|
||||||
WOShellExec.cmd_exec(
|
|
||||||
self,
|
|
||||||
'mysql -e "ALTER USER root@localhost '
|
|
||||||
'IDENTIFIED VIA mysql_native_password;"')
|
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self,
|
self,
|
||||||
'mysql -e "SET PASSWORD = '
|
'mysql -e "SET PASSWORD = '
|
||||||
'PASSWORD(\'{0}\');"'.format(chars))
|
'PASSWORD(\'{0}\'); flush privileges;"'
|
||||||
WOShellExec.cmd_exec(
|
.format(chars))
|
||||||
self, 'mysql -e "flush privileges;"')
|
|
||||||
WOFileUtils.mvfile(
|
WOFileUtils.mvfile(
|
||||||
self, '/etc/mysql/conf.d/my.cnf.tmp',
|
self, '/etc/mysql/conf.d/my.cnf.tmp',
|
||||||
'/etc/mysql/conf.d/my.cnf')
|
'/etc/mysql/conf.d/my.cnf')
|
||||||
@@ -956,6 +952,30 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
Log.error(self, "Unable to set MySQL password")
|
Log.error(self, "Unable to set MySQL password")
|
||||||
WOGit.add(self, ["/etc/mysql"],
|
WOGit.add(self, ["/etc/mysql"],
|
||||||
msg="Adding MySQL into Git")
|
msg="Adding MySQL into Git")
|
||||||
|
elif os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
||||||
|
if ((WOAptGet.is_installed(
|
||||||
|
self, 'mariadb-server-10.5')) and
|
||||||
|
not (WOFileUtils.grepcheck(
|
||||||
|
self, '/etc/mysql/conf.d/my.cnf', 'socket'))):
|
||||||
|
try:
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read('/etc/mysql/conf.d/my.cnf')
|
||||||
|
chars = config['client']['password']
|
||||||
|
WOShellExec.cmd_exec(
|
||||||
|
self,
|
||||||
|
'mysql -e "ALTER USER root@localhost '
|
||||||
|
'IDENTIFIED VIA unix_socket OR '
|
||||||
|
'mysql_native_password; '
|
||||||
|
'SET PASSWORD = PASSWORD(\'{0}\'); '
|
||||||
|
'flush privileges;"'.format(chars))
|
||||||
|
WOFileUtils.textappend(
|
||||||
|
self, '/etc/mysql/conf.d/my.cnf',
|
||||||
|
'socket = /run/mysqld/mysqld.sock')
|
||||||
|
except CommandExecutionError:
|
||||||
|
Log.error(self, "Unable to set MySQL password")
|
||||||
|
WOGit.add(self, ["/etc/mysql"],
|
||||||
|
msg="Adding MySQL into Git")
|
||||||
|
|
||||||
Log.wait(self, "Tuning MariaDB configuration")
|
Log.wait(self, "Tuning MariaDB configuration")
|
||||||
if not os.path.isfile("/etc/mysql/my.cnf.default-pkg"):
|
if not os.path.isfile("/etc/mysql/my.cnf.default-pkg"):
|
||||||
WOFileUtils.copyfile(self, "/etc/mysql/my.cnf",
|
WOFileUtils.copyfile(self, "/etc/mysql/my.cnf",
|
||||||
|
|||||||
Reference in New Issue
Block a user