RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
...
Check the MariaDB Version
Code Block | ||
---|---|---|
| ||
sudo mysql -u <<DB_USERNAME>> -p -V |
Backup the Database
When performing an upgrade, creating a backup or a dump of the existing databases is important just in case if something goes wrong. Dump the database with the following command.
Code Block | ||
---|---|---|
| ||
sudo mysqldump -u <<DB_USERNAME>> -p <<DB_PASSWORD>> --all-databases > /tmp/database-backup.sql |
Alternatively, copy the database directory into a separate folder using this command.
Code Block | ||
---|---|---|
| ||
sudo cp -a /var/lib/mysql /var/lib/mysql.backup |
Backup the configuration file with this command.
Code Block | ||
---|---|---|
| ||
sudo cp -a /etc/my.cnf /etc/my.cnf_bk |
In case of any failures in the upgrade, you can use one of the above copies to restore your databases.
Uninstall the Current MariaDB Repository.You will need to uninstall the old MySQL database before installing the newer version. To do so, you must first stop the MySQL service using the below command.
Code Block | ||
---|---|---|
| ||
sudo systemctl stop mysql |
Check the current status of MySQL using this command.
Code Block | ||
---|---|---|
| ||
sudo systemctl status mysql |
Add the New MariaDB Repository
All the packages need to be up-to-date. Use the following command to update your packages.
Code Block | ||
---|---|---|
| ||
sudo yum update |
Create a new repo file for the latest version.
Code Block | ||
---|---|---|
| ||
vi /etc/yum.repos.d/MariaDB.repo |
Copy and paste the following contents into the /etc/yum.repos.d/mariadb.repo file.
Code Block |
---|
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.11/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 |
To exit and save the Vim file, type :wq and press Enter.
Uninstall the Old MySQL Version
Uninstall the old version of MariaDB using the below command. This command completely removes the old MariaDB version and leaves the databases.
Code Block | ||
---|---|---|
| ||
sudo yum remove mysql sudo yum remove mysql-community-common sudo yum clean all |
Install the Latest Version of MariaDB
Install 10.11 of MariaDB and the most common packages, using the command below.
Code Block | ||
---|---|---|
| ||
sudo yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common |
Start MariaDB
Start the MariaDB service with this command.
Code Block | ||
---|---|---|
| ||
sudo systemctl start mariadb |
To set MariaDB to start automatically when the VM boots up, use the following command.
Code Block | ||
---|---|---|
| ||
sudo systemctl enable mariadb |
Check the current status of MariaDB using this command.
Code Block | ||
---|---|---|
| ||
sudo systemctl status mariadb |
Check the currently installed MariaDB version with this command.
Code Block | ||
---|---|---|
| ||
sudo mysql -u root -p -V |
Upgrade MariaDB
Run the upgrade command to upgrade MySQL database to MariaDB. This command will migrate all the existing databases with its data to latest installed MariaDB
Code Block | ||
---|---|---|
| ||
sudo mysql_upgrade -u root -p |
...