CentOS 7預設的資料庫來源是MariaDB,可是版本過舊,感覺就是不蘇胡;改成新版之後速度有稍微增加一點,但記憶體沒超過1GB的不推薦更新,留一下操作步驟的筆記。
1. 備份資料庫(要輸入密碼唷)
1 2 3 4 5 |
cd /usr/src/ mysqldump -u root -p --all-databases > alldb.sql cp /etc/my.cnf /etc/my.cnf.bak systemctl stop mariadb yum remove -y mariadb mariadb-server |
1 2 3 4 5 6 7 8 9 |
cat >>/etc/yum.repos.d/MariaDB.repo << EOF # MariaDB 10.3 CentOS repository list # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF |
1 2 3 |
yum clean all yum makecache yum install -y mariadb mariadb-server |
1 2 3 |
systemctl enable mariadb systemctl start mariadb mysql_upgrade -uroot -p |
1 2 |
mysql -V mysql -uroot -p |