Table of Contents

Upgrading from MySQL 5.7 to MySQL 8

Prerequisites

To migrate from MySQL 5.7 to MySQL 8 you must be upgraded to at least PFMS version NG 760 MR 52.

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

CentOS 7

/etc/init.d/pandora_server stop
/etc/init.d/pandora_agent_daemon stop
systemctl stop httpd.service

Either:

/etc/init.d/httpd stop
mysqldump -u root -p pandora \
  --skip-add-drop-table \
  --complete-insert \
  --no-create-info> backup_pandora.sql
mysqldump -u root -p pandora> backup_pandora_5.7.sql
cp /etc/my.cnf /tmp/my.cnf.BACK
rpm -qa | grep Percona-Server | xargs rpm -e --nodeps
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y
percona-release setup ps80
yum install percona-server-server
mv /tmp/my.cnf.BACK /etc/my.cnf
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
skip-log-bin

See also “Optimization and troubleshooting” for checking the my.cnf file.

systemctl start mysql

or:

service mysqld start
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)
mysql -u root -p pandora
drop database pandora;
create database pandora;
use pandora;
source /var/www/html/pandora_console/pandoradb.sql;
source backup_pandora.sql;
mysql -u root -p <password>
UNINSTALL COMPONENT 'file://component_validate_password';
CREATE USER "<DBUSER>"@'%' IDENTIFIED BY "<DBPASS>";

Note : if you want to restrict the IP address of connection to the database, you must change the % to the IP address of the connection source.

ALTER USER "<DBUSER>"@'%' IDENTIFIED WITH mysql_native_password BY "<DBPASS>";
GRANT ALL PRIVILEGES ON pandora.* TO "<DBUSER>"@'%';
flush privileges;
exit

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

/etc/init.d/pandora_server start
/etc/init.d/pandora_agent_daemon start
systemctl start httpd.service

Either:

/etc/init.d/httpd start

Rocky Linux 8/AlmaLinux 8/RHEL 8

/etc/init.d/pandora_server stop
/etc/init.d/pandora_agent_daemon stop
systemctl stop httpd.service

Either:

/etc/init.d/httpd stop
mysqldump -u root -p pandora \
  --skip-add-drop-table \
  --complete-insert \
  --no-create-info> backup_pandora.sql
mysqldump -u root -p pandora> backup_pandora_5.7.sql
cp /etc/my.cnf /tmp/my.cnf.BACK
rpm -qa | grep Percona-Server | xargs rpm -e --nodeps
dnf install https://repo.percona.com/yum/percona-release-latest.noarch.rpm -y
percona-release setup ps80
dnf install percona-server-server
mv /tmp/my.cnf.BACK /etc/my.cnf
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
skip-log-bin

See also “Optimization and troubleshooting” for checking the my.cnf file.

systemctl start mysql

or:

service mysqld start
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)
mysql -u root -p pandora
drop database pandora;
create database pandora;
use pandora;
source /var/www/html/pandora_console/pandoradb.sql;
source backup_pandora.sql;
/etc/init.d/pandora_server start
/etc/init.d/pandora_agent_daemon start
systemctl start httpd.service

Either:

/etc/init.d/httpd start

Go back to Pandora FMS documentation index