Bench restore fails on Ubuntu 2020.04 "MariaDB is not properly configured"

Has anyone else seen this and can help explain what to do? Thanks!

The server was recently created based on Ubuntu 20.04 LTS using install.py (Easy install setup guide for erpnext installation on Ubuntu 20.04 LTS. With some modification of course ), and the database backup (.sql.gz) was manually imported using the mysql monitor (i.e. “bench restore” was not used).

frappe@starlord:~/frappe-bench$ bench restore ~/backups/20200718_030011-site1_local-database.sql.gz 
MySQL root password: 
For key collation_server. Expected value utf8mb4_unicode_ci, found value utf8mb4_general_ci
================================================================================
Creation of your site - site1.local failed because MariaDB is not properly 
configured.  If using version 10.2.x or earlier, make sure you use the 
the Barracuda storage engine. 

Please verify the settings above in MariaDB's my.cnf.  Restart MariaDB.  And 
then run `bench new-site site1.local` again.


================================================================================
Database settings do not match expected values; stopping database setup.
frappe@starlord:~/frappe-bench$

Hi @Dale_Scott,
Add these lines in my.cnf file:
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

1 Like
sudo sed -i '/utf8mb4_general_ci/utf8mb4_unicode_ci/' /etc/mysql/my.cnf;
sudo systemctl restart mysql

1 Like

Thanks @arokia and @trentmu for your help. I have two questions.

  1. It seems MariaDb now uses a structured set of .cnf files (or at least seems recommended practise). With this system of .cnf files, is my.cnf still the recommended location for these changes?

  2. what do you think would be the best permanent solution? Should I file a PR against “install.py”

MariaDb version:

frappe@starlord:/etc/mysql$ mysql --verbose --version
mysql  Ver 15.1 Distrib 10.5.4-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
frappe@starlord:/etc/mysql$ 

New .cnf structure:

frappe@starlord:/etc/mysql$ ll /etc/mysql
total 28
drwxr-xr-x   4 root root 4096 Jul 19 04:27 ./
drwxr-xr-x 108 root root 4096 Jul 19 04:22 ../
drwxr-xr-x   2 root root 4096 Jun  9 03:30 conf.d/
-rw-------   1 root root   60 Jun  8 23:21 debian.cnf
-rwxr-xr-x   1 root root 1771 Jun 23 15:10 debian-start*
-rw-r--r--   1 root root  946 Jun 23 15:10 mariadb.cnf
drwxr-xr-x   2 root root 4096 Jun 28 02:57 mariadb.conf.d/
lrwxrwxrwx   1 root root   11 Jun 23 15:15 my.cnf -> mariadb.cnf

frappe@starlord:/etc/mysql$ ll conf.d
total 16
drwxr-xr-x 2 root root 4096 Jun  9 03:30 ./
drwxr-xr-x 4 root root 4096 Jul 19 04:27 ../
-rw-r--r-- 1 root root   36 May 11 14:34 mysqld_safe_syslog.cnf
-rw-r--r-- 1 root root 1988 Jun  9 03:30 settings.cnf
frappe@starlord:/etc/mysql$ ll mariadb.conf.d
total 32
drwxr-xr-x 2 root root 4096 Jun 28 02:57 ./
drwxr-xr-x 4 root root 4096 Jul 19 04:27 ../
-rw-r--r-- 1 root root  679 Jun 23 15:10 50-client.cnf
-rw-r--r-- 1 root root  231 Jun 23 15:10 50-mysql-clients.cnf
-rw-r--r-- 1 root root  917 Jun 23 15:10 50-mysqld_safe.cnf
-rw-r--r-- 1 root root 3635 Jun 23 15:10 50-server.cnf
-rw-r--r-- 1 root root  417 Jun 23 15:10 60-galera.cnf
-rw-r--r-- 1 root root  158 Jun  8 23:22 erpnext.cnf

frappe@starlord:/etc/mysql$ cat mariadb.conf.d/erpnext.cnf 
# BEGIN ANSIBLE MANAGED BLOCK
[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
# END ANSIBLE MANAGED BLOCK

Thanks,
Dale

I saw something similar in ubuntu16 - the DB wouldn’t restart cleanly unless I killed processes. I have a post on ubuntu here - the DB section notes may offer a glimmer of useful info, but I can’t say for sure

1 Like