Upgrading from MySQL 5.7 to MySQL 8

Prerequisites

To migrate from MySQL 5.7 to MySQL 8 you must be updated to at least version 104 of Pandora ITSM.

  • Open a terminal window with the user root and enter the following command:
mysql --version

You will get an answer similar to the following:

mysql  Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
  • Perform a database (hereinafter < pandora_itsm_db_name >) data backup procedure.

Rocky Linux 8/AlmaLinux 8/RHEL 8

  • Stop the Apache web server:
systemctl stop httpd.service

Or:

/etc/init.d/httpd stop
  • Make a special database backup that is compatible with MySQL 8:
mysqldump -u root -p < pandora_itsm_db_name > \
  --skip-add-drop-table \
  --complete-insert \
  --no-create-info> backup_pandora_itsm.sql
  • Make a backup as it is done in MySQL 5.7 (additional insurance if you have to go back to this version):
mysqldump -u root -p < pandora_itsm_db_name > > backup_pandora_itsm_5.7.sql
  • Backup MySQL configuration file (my.cnf):
cp /etc/my.cnf /tmp/my.cnf.BACK
  • Delete Percona 5 repositories:
rpm -qa | grep Percona-Server | xargs rpm -e --nodeps
  • Install Percona 8 repositories:
dnf install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y
  • Enable the repositories from the previous step:
percona-release setup ps80
  • Instalar Percona 8
dnf install percona-server-server
  • Restore the file my.cnf:
mv /tmp/my.cnf.BACK /etc/my.cnf
  • Modify the my.cnf file to eliminate query_cache_*:
sed -i -e "s/^query_cache_type.*/#query_cache_type/g" /etc/my.cnf
sed -i -e "s/^query_cache_size.*/#query_cache_size/g" /etc/my.cnf
sed -i -e "s/^query_cache_min_res_unit.*/#query_cache_min_res_unit/g" /etc/my.cnf
sed -i -e "s/^query_cache_limit.*/#query_cache_limit/g" /etc/my.cnf
  • Start the MySQL service:
systemctl start mysql

Or:

service mysqld start
  • Verify the version installed with:
mysql --version

You will get an answer similar to the following:

mysql  Ver 8.0.28-19 for Linux on x86_64 (Percona Server (GPL), Release 19, Revision 31e88966cd3)

Use MySQL's own command line:

  • Delete the < pandora_itsm_db_name > database.
  • Create a new database < pandora_itsm_db_name >.
  • Open the < pandora_itsm_db_name > database and import the schema found in the PFMS Web Console.
  • Import the data found in the special MySQL 8 compatible backup.
mysql -u root -p < pandora_itsm_db_name >
DROP DATABASE < pandora_itsm_db_name >;
CREATE DATABASE < pandora_itsm_db_name >;
USE < pandora_itsm_db_name >;
SOURCE /var/www/html/pandoraitsm/integria_db.sql;
SOURCE backup_pandora_itsm.sql;
  • The necessary permissions (grants) must be added again; if you are not logged in to mysql as user root (replace < password > with the corresponding password) run:
mysql -uroot -p < password >
  • Once logged in as root, execute the following commands:
  • Disable the plugin validation of password (optional).
UNINSTALL COMPONENT 'file://component_validate_password';
  • If it does not exist, create the login user:
CREATE USER "<DBUSER>"@'%' IDENTIFIED BY "<DBPASS>";

If you want to restrict the IP address of connection to the database, change the % to the IP address of the connection source.

  • Assign the native password for mysql:
ALTER USER "<DBUSER>"@'%' IDENTIFIED WITH mysql_native_password BY "<DBPASS>";
  • Granting grants on the Pandora ITSM database (< pandora_itsm_db_name >):
GRANT ALL PRIVILEGES ON < pandora_itsm_db_name >.* TO "<DBUSER>"@'%';
  • Save changes and exit:
FLUSH privileges;
exit

Once you have finished working with the database, perform the following steps:

  • Start the Apache web server:
systemctl start httpd.service

Or:

/etc/init.d/httpd start

Back to Pandora ITSM Documentation Index