Background
This article explains how to upgrade the default MariaDB 10.1 installation provided with Linux Mint 19 Tara or Tessa to MariaDB 10.3.
One reason why you would want to do this is because of errors such as json not null
which is displayed because older version of MariaDB does not support JSON data type natively.
To see which version of MySQL you are currently using:
mysql --version
To see which Linux Mint version you’re using:
cat /etc/issue
Here is the list of commands used to upgrade the MariaDB server. It involves adding a key for the MariaDB server repo and then doing the update.
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.3/ubuntu bionic main' sudo apt update sudo apt install mariadb-server
Caveat
If you get a Unix Socket error after upgrading, see below:
https://askubuntu.com/questions/705458/ubuntu-15-10-mysql-error-1524-unix-socket
And this one will overwrite authentication method, remove the unix_socket request (and everything else), restoring a normal and working password method:
To fix the Unix Socket error, do the following on the MySQL database console:
update user set plugin="mysql_native_password";
Reference
JSON Not Null Full Error Log
Typical log output if you’re migrating a Laravel table and having the JSON data type issue:
Migrating: 2018_12_07_050334_create_media_table Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json not null,
2 thoughts on “How to upgrade MariaDB from 10.1 to 10.3 Ubuntu Bionic (18.04) LTS Server”
I needed to run `sudo systemctl disable mysqld` before `sudo apt install mariadb-server`
Otherwise `sudo apt install mariadb-server` gives error like
> There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
I think it should be “sudo systemctl stop mysqld” & that worked for me.