centos使用yum升级mariadb5到mariadb10

管理员 2020-03-06
0 549

The suggested upgrade procedure is:

1 Shutdown and uninstall MariaDB 5.5

2 Take a backup (this is the perfect time to take a backup of your databases)

3 Install MariaDB 10.0 [1]

4 Run mysql_upgrade

4.1 Ubuntu and Debian packages do this automatically when they are installed; Red Hat, CentOS, and Fedora packages do not

4.2 mysql_upgrade does two things:

4.2.1 Upgrades the permission tables in the mysql database with some new fields

4.2.2 Does a very quick check of all tables and marks them as compatible with MariaDB 10.0

4.3 In most cases this should be a fast operation (depending of course on the number of tables)

5 Add new options to my.cnf to enable features

5.1 If you change my.cnf then you need to restart mysqld

MariaDB is a drop-in replacement for MySQL installed by default on CentOS 7, and offers many speed and performance improvements. MariaDB offers more storage engines than MySQL, including Cassandra (NoSQL), XtraDB (drop-in replacement for InnoDB), and OQGRAPH.

Pre-Flight Check

These instructions are intended for upgrading from MariaDB 5.5 to MariaDB 10.0 on CentOS 7.

I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.

注:更新前请做好备份避免数据丢失

第一步:添加MariaDB yum源

1.1 更新yum

yum -y update


1.2 添加源

vim /etc/yum.repos.d/MariaDB10.repo
# MariaDB 10.0 CentOS repository list – created 2014-10-13 13:04 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

保存并退出

第二步:删除原数据库

.1 停止MariaDB:

systemctl stop mariadb

2.2 删除MariaDB包:

yum remove mariadb-server mariadb mariadb-libs

2.3 使用以下命令清理yum缓存信息:

yum clean all

第三步:安装MariaDB 10.0

3.1 此时,安装MariaDB 10.0就像只运行一个命令一样简单:

yum -y install MariaDB-server MariaDB-client

3.2 启动

systemctl start mysql

3.3 设置开机启动

systemctl enable mysql

3.4 执行mysql_upgrade

mysql_upgrade

3.4 查看版本

mysql --version

升级完成

回复
  • 消灭零回复