MariaDB:升级(5.5.6 –> 10.4.1) on CentOS 7
首先,看看当前数据库的信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
[root@oracleme ~]# service mariadb status Redirecting to /bin/systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2019-01-18 22:19:27 CST; 5s ago Process: 20862 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS) Process: 20830 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS) Main PID: 20861 (mysqld_safe) Tasks: 21 CGroup: /system.slice/mariadb.service ├─20861 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─21227 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysq... Jan 18 22:19:24 vesta.gds-services.com systemd[1]: Starting MariaDB database ... Jan 18 22:19:25 vesta.gds-services.com mariadb-prepare-db-dir[20830]: Databas... Jan 18 22:19:25 vesta.gds-services.com mysqld_safe[20861]: 190118 22:19:25 my... Jan 18 22:19:25 vesta.gds-services.com mysqld_safe[20861]: 190118 22:19:25 my... Jan 18 22:19:27 vesta.gds-services.com systemd[1]: Started MariaDB database s... Hint: Some lines were ellipsized, use -l to show in full. [root@oracleme ~]# [root@oracleme ~]# mysql -V mysql Ver 15.1 Distrib 5.5.60-MariaDB, for Linux (x86_64) using readline 5.1 [root@oracleme ~]# [root@oracleme ~]# mysql -u root Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> select version(); +----------------+ | version() | +----------------+ | 5.5.60-MariaDB | +----------------+ 1 row in set (0.00 sec) MariaDB [(none)]> MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | admin_default | | mysql | | performance_schema | | roundcube | | yuyihuan_itop | +--------------------+ 6 rows in set (0.00 sec) MariaDB [(none)]> MariaDB [(none)]> select user,host from mysql.user; +-----------------+-----------+ | user | host | +-----------------+-----------+ | admin_default | % | | yuyihuan_itroot | % | | admin_default | localhost | | root | localhost | | roundcube | localhost | | yuyihuan_itroot | localhost | +-----------------+-----------+ 6 rows in set (0.00 sec) MariaDB [(none)]> |
备份原库:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[root@oracleme mysql_data]# pwd /backup/mysql_data [root@oracleme mysql_data]# [root@oracleme mysql_data]# ls -ltr total 0 [root@oracleme mysql_data]# [root@oracleme mysql_data]# mysqldump -u root --all-databases > mariadb_backup_data_all_db.sql [root@oracleme mysql_data]# [root@oracleme mysql_data]# ls -ltr total 520 -rw-r--r--. 1 root root 530379 Jan 18 22:21 mariadb_backup_data_all_db.sql [root@oracleme mysql_data]# [root@oracleme mysql_data]# du -sh * 520K mariadb_backup_data_all_db.sql [root@oracleme mysql_data]# [root@oracleme mysql_data]# cp -rf /etc/my.cnf* . [root@oracleme mysql_data]# ls -ltr total 524 -rw-r--r--. 1 root root 530379 Jan 18 22:21 mariadb_backup_data_all_db.sql drwxr-xr-x. 2 root root 67 Jan 18 22:23 my.cnf.d -rw-r--r--. 1 root root 737 Jan 18 22:23 my.cnf [root@oracleme mysql_data]# [root@oracleme mysql_data]# ls -ltr my.cnf.d/ total 12 -rw-r--r--. 1 root root 744 Jan 18 22:23 server.cnf -rw-r--r--. 1 root root 232 Jan 18 22:23 mysql-clients.cnf -rw-r--r--. 1 root root 295 Jan 18 22:23 client.cnf [root@oracleme mysql_data]# |
配置YUM文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
[root@oracleme ~]# ls -ltr /etc/yum.repos.d/ total 96 -rw-r--r--. 1 root root 1050 Oct 3 2017 epel-testing.repo -rw-r--r--. 1 root root 951 Oct 3 2017 epel.repo -rw-r--r--. 1 root root 5701 Nov 23 21:16 CentOS-Vault.repo -rw-r--r--. 1 root root 1331 Nov 23 21:16 CentOS-Sources.repo -rw-r--r--. 1 root root 630 Nov 23 21:16 CentOS-Media.repo -rw-r--r--. 1 root root 314 Nov 23 21:16 CentOS-fasttrack.repo -rw-r--r--. 1 root root 649 Nov 23 21:16 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 1309 Nov 23 21:16 CentOS-CR.repo -rw-r--r--. 1 root root 1664 Nov 23 21:16 CentOS-Base.repo -rw-r--r--. 1 root root 750 Dec 22 01:50 remi-safe.repo -rw-r--r--. 1 root root 1314 Dec 22 01:50 remi-php73.repo -rw-r--r--. 1 root root 1314 Dec 22 01:50 remi-php72.repo -rw-r--r--. 1 root root 1314 Dec 22 01:50 remi-php71.repo -rw-r--r--. 1 root root 1314 Dec 22 01:50 remi-php70.repo -rw-r--r--. 1 root root 456 Dec 22 01:50 remi-php54.repo -rw-r--r--. 1 root root 446 Dec 22 01:50 remi-glpi94.repo -rw-r--r--. 1 root root 446 Dec 22 01:50 remi-glpi93.repo -rw-r--r--. 1 root root 446 Dec 22 01:50 remi-glpi92.repo -rw-r--r--. 1 root root 446 Dec 22 01:50 remi-glpi91.repo -rw-r--r--. 1 root root 2605 Jan 18 17:16 remi.repo -rw-r--r--. 1 root root 99 Jan 18 17:16 nginx.repo -rw-r--r--. 1 root root 145 Jan 18 17:16 vesta.repo -rw-r--r--. 1 root root 87 Jan 18 22:26 mariadb.repo [root@oracleme ~]# [root@oracleme ~]# cat /etc/yum.repos.d/mariadb.repo [mariadb] name=MariaDB baseurl=http://yum.mariadb.org/10.4.1/centos7-amd64/ gpgcheck=0 [root@oracleme ~]# [root@oracleme ~]# vi /etc/yum.conf [root@oracleme ~]# [root@oracleme ~]# cat /etc/yum.conf | grep keepcache keepcache=1 [root@oracleme ~]# |
刷新YUM:[……]