Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> MySQL

การ Upgrade MySQL Binary หรือ Package-based Installations บน Unix/Linux

Upgrade MySQL binary/package-based installations บน Unix/Linux: in-place และ logical upgrade methods

In-place Upgrade

  • Shutdown old MySQL server
  • Replace old binaries/packages ด้วย new ones
  • Restart MySQL server บน existing data directory
  • Upgrade remaining parts ที่ต้องการ
  • บาง Linux platforms: RPM/Debian packages รวม 'systemd' support จัดการ startup/shutdown (mysqld_safe ไม่ได้ติดตั้ง)

Logical Upgrade

  • Export SQL จาก old MySQL instance
  • Export existing data จาก previous installation:
mysqldump -u root -p --add-drop-table --routines --events --all-databases --force > data-for-upgrade.sql
  • Shutdown old server: mysqladmin -u root -p shutdown
  • Initialize new data directory: mysqld --initialize --datadir=/path/to/8.0-datadir &
  • Reset root password:
shell> mysql -u root -p
Enter password: ****  <- temporary root password
mysql> ALTER USER USER() IDENTIFIED BY 'your new password';
  • Load dump file เข้า new server: mysql -u root -p --force < data-for-upgrade.sql

MySQL Cluster Upgrade

  • Upgrade MGM nodes
  • Upgrade data nodes ทีละตัว
  • Upgrade API nodes ทีละตัว (รวม MySQL servers)
  • Upgrade data dictionary
  • Upgrade system tables
  • Restart system