Testing MariaDB 10.5

This commit is contained in:
VirtuBox
2020-10-22 11:04:23 +02:00
parent fd66b5475f
commit dff13eb345
3 changed files with 16 additions and 43 deletions

View File

@@ -45,39 +45,6 @@ def pre_pref(self, apt_packages):
if "mariadb-server" in apt_packages:
# generate random 24 characters root password
chars = ''.join(random.sample(string.ascii_letters, 24))
Log.debug(self, "Pre-seeding MySQL")
Log.debug(self, "echo \"mariadb-server-{0} "
"mysql-server/root_password "
"password \" | "
"debconf-set-selections"
.format(WOVar.mariadb_ver))
try:
WOShellExec.cmd_exec(self, "echo \"mariadb-server-{0} "
"mysql-server/root_password "
"password {chars}\" | "
"debconf-set-selections"
.format(WOVar.mariadb_ver, chars=chars),
log=False)
except CommandExecutionError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Failed to initialize MySQL package")
Log.debug(self, "echo \"mariadb-server-{0} "
"mysql-server/root_password_again "
"password \" | "
"debconf-set-selections"
.format(WOVar.mariadb_ver))
try:
WOShellExec.cmd_exec(self, "echo \"mariadb-server-{0} "
"mysql-server/root_password_again "
"password {chars}\" | "
"debconf-set-selections"
.format(WOVar.mariadb_ver, chars=chars),
log=False)
except CommandExecutionError as e:
Log.debug(self, "{0}".format(e))
Log.error(self, "Failed to initialize MySQL package")
# generate my.cnf root credentials
mysql_config = """
[client]
@@ -966,7 +933,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
config_file.close()
else:
# make sure root account have all privileges
if "PASSWORD" not in WOShellExec.cmd_exec_stdout(
if "IDENTIFIED BY PASSWORD" not in WOShellExec.cmd_exec_stdout(
self, 'mysql -e "use mysql; show grants;"'):
try:
if not os.path.exists('/etc/mysql/conf.d/my.cnf'):
@@ -975,10 +942,13 @@ def post_pref(self, apt_packages, packages, upgrade=False):
config.read('/etc/mysql/conf.d/my.cnf')
chars = config['client']['password']
WOShellExec.cmd_exec(
self, "mysql -e \"use mysql; "
"GRANT ALL PRIVILEGES on "
"*.* TO 'root'@'127.0.0.1' IDENTIFIED by "
"'{0}' WITH GRANT OPTION\"".format(chars))
self,
'mysql -e "ALTER USER root@localhost '
'IDENTIFIED VIA mysql_native_password;"')
WOShellExec.cmd_exec(
self,
'mysql -e "SET PASSWORD = '
'PASSWORD(\'{0}\');"'.format(chars))
WOShellExec.cmd_exec(
self, 'mysql -e "flush privileges;"')
except CommandExecutionError:
@@ -1001,11 +971,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
elif (wo_ram > 64000):
wo_innodb_instance = int(64)
tmp_table_size = int(256)
mariadbconf = bool(not os.path.exists(
'/etc/mysql/mariadb.conf.d/50-server.cnf'))
data = dict(
tmp_table_size=tmp_table_size, inno_log=wo_ram_log_size,
inno_buffer=wo_ram_innodb,
inno_log_buffer=wo_ram_log_buffer,
innodb_instances=wo_innodb_instance)
innodb_instances=wo_innodb_instance,
newmariadb=mariadbconf)
if os.path.exists('/etc/mysql/mariadb.conf.d/50-server.cnf'):
WOTemplate.deploy(
self, '/etc/mysql/my.cnf', 'my.mustache', data)

View File

@@ -41,7 +41,6 @@ tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
skip-name-resolve = 1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
@@ -191,5 +190,6 @@ key_buffer = 16M
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
{{#newmariadb}}
!include /etc/mysql/mariadb.cnf
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/conf.d/{{/newmariadb}}

View File

@@ -166,7 +166,7 @@ class WOVar():
else:
mariadb_ver = '10.3'
else:
mariadb_ver = '10.3'
mariadb_ver = '10.5'
if wo_platform_codename == 'jessie':
wo_mysql = wo_mysql + ["python3-mysql.connector"]
else:
@@ -185,7 +185,7 @@ class WOVar():
# APT repositories
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
"http://mariadb.mirrors.ovh.net/MariaDB/repo/"
"10.3/{distro} {codename} main"
"10.5/{distro} {codename} main"
.format(distro=wo_distro,
codename=wo_platform_codename))
if wo_distro == 'ubuntu':