• THMOD02: โปรดระมัดระวังอย่าให้ข้อมูลที่เป็นส่วนตัวแก่สมาชิกใดๆ หลีกเลี่ยงการรับชำระเงินผ่านธนาคารไทย หลีกเลี่ยงการสนทนาจากผู้ที่ต้องการนัดพบเจอ! เราไม่สนับสนุนดีลที่ไม่ปลอดภัย! หากคุณมีหลักฐานสามารถรายงานมายังเจ้าหน้าที่ เราจะดำเนินการแบน User อย่างถาวร! เราพยายามปกป้องความเสี่ยงของสมาชิกที่ได้รับการยืนยันจากเรา

Fix วิธีการอัพเดท MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.x บน Linux

L

Linuxy

สมาชิกใหม่
เจ้าหน้าที่
สมาชิกรุ่นแรก
สมาชิก
LV
1
 
คะแนนธุระกิจ
0
รางวัล
6
เครดิต
$0.02

คำถาม​

จะอัพเกรด 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 บน Linux

Note: 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

  1. 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
  2. Stop MariaDB:
    Perl:
    service mariadb stop
  3. Remove additional package conflicting with 10.4 version:
    Perl:
    yum remove mariadb-gssapi-server
  4. For security reasons, copy the database directory in a separate folder:
    Perl:
    cp -v -a /var/lib/mysql/ /var/lib/mysql_backup
  5. 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
    5.2. Add the content below to the file:
    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
    The configuration item module_hotfixes=1 is a workaround for what MariaDB told is a dnf bug. See MDEV-20673 for more details
    5.3. Save the changes and close the file.
  6. Reset all the cache:
    Perl:
    yum clean all
  7. Start an upgrade of MariaDB to 10.4:
    Perl:
    yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
  8. Once the upgrade is finished, start MariaDB:
    Perl:
    systemctl restart mariadb
  9. Upgrade MySQL databases:
    Perl:
    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
  10. Restart mariadb service:
    Perl:
    systemctl restart mariadb
  11. Execute this command to update the package version inside Plesk:
    Perl:
    plesk sbin packagemng -sdf
  12. Restore SeLinux context:
    Perl:
    restorecon -v /var/lib/mysql/*

สำหรับ CentOS / RHEL7

สำหรับ CloudLinux

สำหรับ Debian 9

สำหรับ Debian 10

สำหรับ Ubuntu 18.04

สำหรับ Ubuntu 20.04

 

ไฟล์แนบ

  • mariadb-10.5-upgrade.sh
    1.3 KB · รับชม: 4,918
Top