Ubuntu 16的默认mysql版本比较低,很多新的数据库要求越来越高,所以手动升级更换为MariaDB 10.4,步骤如下
停止原有MySQL服务并卸载
sudo service stop mysql
sudo service mysql stop
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt autoremove
sudo service nginx stop
sudo apt autoremove
sudo apt-get autoremove
添加MariaDB的安装源,查询网址https://downloads.mariadb.org/mariadb/repositories/
sudo apt-get install software-properties-common gnupg-curl
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] https://ftp.heanet.ie/mirrors/mariadb/repo/10.4/ubuntu xenial main'
sudo apt-get install apt-transport-https ca-certificates
sudo apt update
sudo apt install mariadb-server
sudo service mysql start
安装完成,但是我遇到了“Your privilege table structure seems to be older than this MySQL version”错误,以及无法使用mysqdump导出数据,所以还要手动更新数据库
mysql_upgrade --force -u root -p