How do I upgrade my MySQL 5.7 database to MySQL 8?

A MySQL upgrade is done by exporting the existing database, creating a new MySQL 8 database, and importing the exported data into it. Then, update the database details in your application's configuration file.

Warning: Changes to databases and configuration files can cause your website to become inaccessible. Make a full backup of your website and database before starting.
Note: This guide differs depending on the system (CloudPit or Control Panel). Use the appropriate section.

If you wish, we can perform the upgrade as part of our Premium Services.

Table of Contents

Overview of the process

  1. Locate the configuration file of your application.
  2. Note down the database name, database user, database password, and database server.
  3. Open the existing database in phpMyAdmin and export it as an SQL file.
  4. Create a new MySQL 8 database.
  5. Import the exported SQL file into the new database.
  6. Update the database details in your application's configuration file.
  7. Test the website.

For WordPress, the configuration file is wp-config.php.

Switch WordPress database to MySQL 8 in CloudPit

Check WordPress directory

In CloudPit, open the desired web hosting package via Manage.

On the left, open the Domains section. For the affected domain, you will see the path to the WordPress installation.

Open wp-config.php

Open FTPWeb FTP.

Navigate to the WordPress directory and open the file wp-config.php.

Note the following values:

  • DB_NAME – database name
  • DB_USER – database user
  • DB_PASSWORD – database password
  • DB_HOST – database server

Export existing database

Open Databases.

For the existing database, click ActionsOpen phpMyAdmin.

Export the database in phpMyAdmin as an SQL file.

Create new MySQL 8 database

Create a new database with MySQL 8 in CloudPit.

If possible, use the same password or securely note the new password.

Check SQL file

Open the exported SQL file in a text editor.

If the file contains lines like these, replace the old database name with the new database name:

-- Database: `XXXX`
--
CREATE DATABASE IF NOT EXISTS `XXXX` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `XXXX`;

Then save the SQL file.

Import database

Open the new MySQL 8 database in phpMyAdmin.

Import the previously exported and adjusted SQL file.

Adjust wp-config.php

Open the file wp-config.php again.

Adjust the values for database name, database user, database password, and database server to the new MySQL 8 database.

In CloudPit, the database server for MySQL 8 is:

127.0.0.1:3307

Save the file.

Then test whether your WordPress website works correctly.

Note: Keep the old database values for now. If problems occur, you can revert the values in wp-config.php back to the old database.

Switch WordPress database to MySQL 8 in Control Panel

Check WordPress directory

In Control Panel, open Domains and then the affected domain.

Open Subdomains. There you will see under Webspace Content the location of the WordPress installation.

Open wp-config.php

Open WebhostingWeb FTP.

Navigate to the WordPress directory and open the file wp-config.php.

Note the following values:

  • DB_NAME – database name
  • DB_USER – database user
  • DB_PASSWORD – database password
  • DB_HOST – database server

Export existing database

Open WebhostingDatabases.

For the existing database, click Open phpMyAdmin for this database.

Export the database in phpMyAdmin as an SQL file.

Create new MySQL 8 database

Create a new database with MySQL 8 in Control Panel.

If possible, use the same password or securely note the new password.

Check SQL file

Open the exported SQL file in a text editor.

If the file contains lines like these, replace the old database name with the new database name:

-- Database: `XXXX`
--
CREATE DATABASE IF NOT EXISTS `XXXX` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `XXXX`;

Then save the SQL file.

Import database

Open the new MySQL 8 database in phpMyAdmin.

Import the previously exported and adjusted SQL file.

Adjust wp-config.php

Open the file wp-config.php again.

Adjust the values for database name, database user, database password, and database server to the new MySQL 8 database.

In Control Panel, the database server for MySQL 8 is:

mysql80.local:3307

Save the file.

Then test whether your WordPress website works correctly.

Note: Keep the old database values for now. If problems occur, you can revert the values in wp-config.php back to the old database.