L
Linuxy
สมาชิกใหม่
เจ้าหน้าที่
สมาชิกรุ่นแรก
สมาชิก
LV
1
คำถาม
จะอัพเกรด MySQL 5.5 เป็น 5.6/5.7 หรือ MariaDB 5.5 เป็น 10.X บน Linux ได้อย่างไรตอบ
บทความนี้ให้คำแนะนำในการอัพเกรด MySQL 5.5 เป็น 5.6/5.7 และ MariaDB 5.5 เป็น 10.0/10.1/10.2/10.3/10.4/10.5 บน LinuxNote: Upgrade can be performed in a command-line interface with the instructions below at your own risk. This task is supposed to be performed by a system administrator.
If you are not familiar with Linux system administering and would like our professionals to handle this task on your behalf, contact Professional Services team at https://www.plesk.com/professional-services/.
หากต้องการทราบการกระจาย Linux ของคุณ ให้เรียกใช้:
Perl:
plesk version | grep "OS version"
หรือ:
Perl:
cat /etc/*-release
⚠️ คำเตือน: รองรับ MariaDB 10.4 และ 10.5 ตั้งแต่ Plesk Obsidian 18.0.30 เวอร์ชันก่อนหน้า (Onyx และเก่ากว่า) ไม่รองรับ MariaDB ตั้งแต่ 10.3 และไม่มีแผนที่จะนำไปใช้ในปัจจุบัน
คำเตือน:
การอัปเกรดโดยตรงจาก MySQL 5.1 เป็น MySQL 5.6/5.7 จะทำให้โครงสร้างตารางเสียหาย คำแนะนำสำหรับการอัพเกรด MySQL จาก 5.1 เป็น 5.5 บน Linux มีอยู่ที่นี่: วิธีอัปเกรด MySQL จาก 5.1 เป็น 5.5 บน Linux
ขอแนะนำอย่างยิ่งให้สร้างสแนปชอตเซิร์ฟเวอร์ (สำรองข้อมูลทั้งหมด) ก่อนอัปเกรด ทำการอัปเกรด MySQL ด้วยความเสี่ยงของคุณเอง
ก่อนเริ่มการอัปเกรด MySQL ให้หยุดบริการ WatchDog หากใช้งานบนเซิร์ฟเวอร์ ตรวจสอบสถานะด้วยคำสั่ง
service watchdog status
หมายเหตุ: MySQL จะไม่ได้รับการอัพเกรดบนระบบปฏิบัติการที่ใช้ CentOS/RHEL หากติดตั้งจากที่เก็บ Webtatic Yum:
Perl:
rpm -qa | grep -i mysql
mysql55w-server-5.5.57-1.w6.x86_64
ในการเริ่มต้นอัปเกรด MySQL/MariaDB ให้เชื่อมต่อกับเซิร์ฟเวอร์ผ่าน SSH เป็น root/superuser และทำตามคำแนะนำสำหรับระบบปฏิบัติการของคุณ:
สำหรับ CentOS
- For security reasons, create a database dump of all databases with the following command:
Perl:MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --verbose --all-databases --routines --triggers > /tmp/all-databases.sql
- Stop MariaDB:
Perl:service mariadb stop
- Remove additional package conflicting with 10.4 version:
Perl:yum remove mariadb-gssapi-server
- For security reasons, copy the database directory in a separate folder:
Perl:cp -v -a /var/lib/mysql/ /var/lib/mysql_backup
- Configure MariaDB repository: open the Setting MariaDB repositories page, select your OS distro, release, and desired MariaDB version. Once done, the configuration that should be added to the
/etc/yum.repos.d/MariaDB.repo
file will appear.
Warning: MariaDB 10.4 and 10.5 are supported since 18.0.30, make sure the latest Plesk version is installed.
Here is an example for MariaDB 10.4:
5.1. Open/create the MariaDB.repo file in any text editor. In this example, we are using the vi editor:
Perl:vi /etc/yum.repos.d/MariaDB.repo
Perl:[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 priority=1 module_hotfixes=1
5.3. Save the changes and close the file. - Reset all the cache:
Perl:yum clean all
- Start an upgrade of MariaDB to 10.4:
Perl:yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
- Once the upgrade is finished, start MariaDB:
Perl:systemctl restart mariadb
- Upgrade MySQL databases:
Perl:MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
- Restart mariadb service:
Perl:systemctl restart mariadb
- Execute this command to update the package version inside Plesk:
Perl:plesk sbin packagemng -sdf
- Restore SeLinux context:
Perl:restorecon -v /var/lib/mysql/*