How to upgrade MySQL/MariaDB on the command line Print

  • 1

Overview

MySQL/MariaDB can be upgraded through WHM's "MySQL/MariaDB Upgrade" interface or from the command line via the API. This article describes how to upgrade MySQL/MariaDB using the command line.

  • Access the command line as the 'root' user using SSH or WHM's "Terminal" interface.
  • Utilise the background_mysql_upgrade_checker_run API method to verify the current status of MySQL and MariaDB.
[root@server ~]cPs# whmapi1 background_mysql_upgrade_checker_run
---
data:
log_entry: mysql_upgrade_checker_2023-02-24T14:30:53Z
pid: 114733
metadata:
command: background_mysql_upgrade_checker_run
reason: OK
result: 1
version: 1
[root@server ~]cPs#
  • Review the upgrade checker log at  /var/cpanel/logs/$log_entry/txt.

Please note that "$log_entry" should be replaced with the log_entry value returned by the background_mysql_upgrade_checker_run API call.

All errors in the log must be addressed before proceeding with the upgrade.

  • Run the installable_mysql_versions API call to view the MySQL/MariaDB versions to which the current installation may be upgraded.
[root@server ~]cPs# whmapi1 installable_mysql_versions
---
data:
versions:
-
server: mysql
version: '8.0'
-
server: mariadb
version: '10.5'
-
server: mariadb
version: '10.6'
metadata:
command: installable_mysql_versions
reason: OK
result: 1
version: 1
[root@server ~]cPs#
  • Run the start_background_mysql_upgrade API call to initiate the upgrade process.
whmapi1 start_background_mysql_upgrade version=$version

Please note that "$version" should be replaced with the applicable version returned from the installable_mysql_versions API call.


To see the upgrade progress and review any errors the upgrade may have encountered, you can review the upgrade log, located at:

/var/cpanel/logs/$upgrade_id/unattended_background_upgrade.log

Please note that $upgrade_id should be replaced with the upgrade_id value returned from the start_background_mysql_upgrade API call.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution