Fix Mariadb 10.5 setup
This commit is contained in:
@@ -54,13 +54,13 @@ def pre_pref(self, apt_packages):
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read_string(mysql_config)
|
config.read_string(mysql_config)
|
||||||
Log.debug(self, 'Writting configuration into MySQL file')
|
Log.debug(self, 'Writting configuration into MySQL file')
|
||||||
conf_path = "/etc/mysql/conf.d/my.cnf"
|
conf_path = "/etc/mysql/conf.d/my.cnf.tmp"
|
||||||
os.makedirs(os.path.dirname(conf_path), exist_ok=True)
|
os.makedirs(os.path.dirname(conf_path), exist_ok=True)
|
||||||
with open(conf_path, encoding='utf-8',
|
with open(conf_path, encoding='utf-8',
|
||||||
mode='w') as configfile:
|
mode='w') as configfile:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
Log.debug(self, 'Setting my.cnf permission')
|
Log.debug(self, 'Setting my.cnf permission')
|
||||||
WOFileUtils.chmod(self, "/etc/mysql/conf.d/my.cnf", 0o600)
|
WOFileUtils.chmod(self, "/etc/mysql/conf.d/my.cnf.tmp", 0o600)
|
||||||
|
|
||||||
# add nginx repository
|
# add nginx repository
|
||||||
if set(WOVar.wo_nginx).issubset(set(apt_packages)):
|
if set(WOVar.wo_nginx).issubset(set(apt_packages)):
|
||||||
@@ -936,10 +936,10 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
if "IDENTIFIED BY PASSWORD" not in WOShellExec.cmd_exec_stdout(
|
if "IDENTIFIED BY PASSWORD" not in WOShellExec.cmd_exec_stdout(
|
||||||
self, 'mysql -e "use mysql; show grants;"'):
|
self, 'mysql -e "use mysql; show grants;"'):
|
||||||
try:
|
try:
|
||||||
if not os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
if not os.path.exists('/etc/mysql/conf.d/my.cnf.tmp'):
|
||||||
Log.error(self, 'my.cnf not found')
|
Log.error(self, 'my.cnf not found')
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('/etc/mysql/conf.d/my.cnf')
|
config.read('/etc/mysql/conf.d/my.cnf.tmp')
|
||||||
chars = config['client']['password']
|
chars = config['client']['password']
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self,
|
self,
|
||||||
@@ -951,6 +951,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
'PASSWORD(\'{0}\');"'.format(chars))
|
'PASSWORD(\'{0}\');"'.format(chars))
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, 'mysql -e "flush privileges;"')
|
self, 'mysql -e "flush privileges;"')
|
||||||
|
WOFileUtils.mvfile(
|
||||||
|
self, '/etc/mysql/conf.d/my.cnf.tmp',
|
||||||
|
'/etc/mysql/conf.d/my.cnf')
|
||||||
except CommandExecutionError:
|
except CommandExecutionError:
|
||||||
Log.error(self, "Unable to set MySQL password")
|
Log.error(self, "Unable to set MySQL password")
|
||||||
Log.info(self, "Tuning MariaDB configuration")
|
Log.info(self, "Tuning MariaDB configuration")
|
||||||
@@ -1001,10 +1004,10 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
# on the amount of RAM
|
# on the amount of RAM
|
||||||
|
|
||||||
WOService.stop_service(self, 'mysql')
|
WOService.stop_service(self, 'mysql')
|
||||||
WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile0',
|
# WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile0',
|
||||||
'/var/lib/mysql/ib_logfile0.bak')
|
# '/var/lib/mysql/ib_logfile0.bak')
|
||||||
WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile1',
|
# WOFileUtils.mvfile(self, '/var/lib/mysql/ib_logfile1',
|
||||||
'/var/lib/mysql/ib_logfile1.bak')
|
# '/var/lib/mysql/ib_logfile1.bak')
|
||||||
WOService.start_service(self, 'mysql')
|
WOService.start_service(self, 'mysql')
|
||||||
|
|
||||||
WOCron.setcron_weekly(self, 'mysqlcheck -Aos --auto-repair '
|
WOCron.setcron_weekly(self, 'mysqlcheck -Aos --auto-repair '
|
||||||
|
|||||||
Reference in New Issue
Block a user