Friday, June 23, 2023

.::: Upgrading from MariaDB 10.4 to MariaDB 10.6 :::.

1. check Repo for 10.4
[root@teguhth ~]# cat /etc/yum.repos.d/mariadb.repo
[mariadb-main]
name = MariaDB Server
baseurl = https://dlm.mariadb.com/repo/mariadb-server/10.4/yum/rhel/7/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY
gpgcheck = 0
enabled = 1

[mariadb-maxscale]
# To use the latest stable release of MaxScale, use "latest" as the version
# To use the latest beta (or stable if no current beta) release of MaxScale, use "beta" as the version
name = MariaDB MaxScale
baseurl = https://dlm.mariadb.com/repo/maxscale/latest/yum/rhel/7/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-MaxScale-GPG-KEY
gpgcheck = 1
enabled = 1

[mariadb-tools]
name = MariaDB Tools
baseurl = https://downloads.mariadb.com/Tools/rhel/7/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Enterprise-GPG-KEY
gpgcheck = 1
enabled = 1
[root@teguhth ~]#


2. check rpm for 10.4
[root@teguhth ~]# rpm -qa | grep -i '^mariadb'
MariaDB-common-10.4.30-1.el7.centos.x86_64
MariaDB-compat-10.4.30-1.el7.centos.x86_64
MariaDB-client-10.4.30-1.el7.centos.x86_64
MariaDB-server-10.4.30-1.el7.centos.x86_64
MariaDB-shared-10.4.30-1.el7.centos.x86_64
[root@teguhth ~]#

3. change repo to 10.6
[root@teguhth ~]# cat /etc/yum.repos.d/mariadb.repo
[mariadb-main]
name = MariaDB Server
baseurl = https://dlm.mariadb.com/repo/mariadb-server/10.6/yum/rhel/7/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Server-GPG-KEY
gpgcheck = 0
enabled = 1

[mariadb-maxscale]
# To use the latest stable release of MaxScale, use "latest" as the version
# To use the latest beta (or stable if no current beta) release of MaxScale, use "beta" as the version
name = MariaDB MaxScale
baseurl = https://dlm.mariadb.com/repo/maxscale/latest/yum/rhel/7/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-MaxScale-GPG-KEY
gpgcheck = 1
enabled = 1

[mariadb-tools]
name = MariaDB Tools
baseurl = https://downloads.mariadb.com/Tools/rhel/7/x86_64
gpgkey = file:///etc/pki/rpm-gpg/MariaDB-Enterprise-GPG-KEY
gpgcheck = 1
enabled = 1
[root@teguhth ~]#


4. check version before update

[root@teguhth ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.4.30-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select @@hostname,@@version;
+------------+-----------------+
| @@hostname | @@version       |
+------------+-----------------+
| teguhth    | 10.4.30-MariaDB |
+------------+-----------------+
1 row in set (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| secretdb           |
| teguhth            |
+--------------------+
5 rows in set (0.000 sec)

MariaDB [(none)]> select * from teguhth.barang;
+-------------+-------------+---------------+-------------+
| KODE_BARANG | NAMA_BARANG | SATUAN_BARANG | STOK_BARANG |
+-------------+-------------+---------------+-------------+
| ELK-01      | RICE COOKER | BUAH          |          20 |
| ELK-02      | LEMARI ES   | UNIT          |           8 |
| ELK-03      | TELEVISI    | UNIT          |          30 |
| ELK-04      | RADIO/TAPE  | BUAH          |          35 |
| ELK-05      | KOMPUTER    | UNIT          |          28 |
| ELK-06      | KIPAS ANGIN | BUAH          |          38 |
+-------------+-------------+---------------+-------------+
6 rows in set (0.001 sec)

MariaDB [(none)]>
 


5. stop mariadb & remove old mariadb
systemctl stop mariadb
yum remove MariaDB-server -y

[root@teguhth ~]# systemctl stop mariadb
[root@teguhth ~]# yum remove MariaDB-server -y


6. Install new mariadb
[root@teguhth ~]# yum install MariaDB-server -y
 
Running transaction
  Installing : MariaDB-common-10.6.12-1.el7.centos.x86_64     1/5
  Installing : MariaDB-compat-10.6.12-1.el7.centos.x86_64      2/5
  Installing : MariaDB-client-10.6.12-1.el7.centos.x86_64   3/5
  Installing : MariaDB-server-10.6.12-1.el7.centos.x86_64     4/5
  Installing : MariaDB-shared-10.6.12-1.el7.centos.x86_64     5/5
 

7. check rpm after upgrade new version
[root@teguhth ~]# rpm -qa | grep -i '^mariadb'
MariaDB-common-10.6.14-1.el7.centos.x86_64
MariaDB-client-10.6.14-1.el7.centos.x86_64
MariaDB-compat-10.4.30-1.el7.centos.x86_64
MariaDB-server-10.6.14-1.el7.centos.x86_64
MariaDB-shared-10.6.14-1.el7.centos.x86_64
[root@teguhth ~]#

8. start mariadb
[root@teguhth ~]# systemctl start mariadb
[root@teguhth ~]#

9. run mariadb upgrade  
 
mysql_upgrade

[root@teguhth ~]# mysql_upgrade
Major version upgrade detected from 10.4.30-MariaDB to 10.6.14-MariaDB. Check required!
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
mysql.user                                         OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
performance_schema
secretdb
sys
sys.sys_config                                     OK
teguhth
teguhth.barang                                     OK
teguhth.customer                                   OK
teguhth.pasok                                      OK
teguhth.pembelian                                  OK
teguhth.suplier                                    OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
[root@teguhth ~]#


10. check login

[root@teguhth ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.6.14-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select @@hostname,@@version;
+------------+-----------------+
| @@hostname | @@version       |
+------------+-----------------+
| teguhth    | 10.6.14-MariaDB |
+------------+-----------------+
1 row in set (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| secretdb           |
| sys                |
| teguhth            |
+--------------------+
6 rows in set (0.000 sec)

MariaDB [(none)]> select * from teguhth.barang;
+-------------+-------------+---------------+-------------+
| KODE_BARANG | NAMA_BARANG | SATUAN_BARANG | STOK_BARANG |
+-------------+-------------+---------------+-------------+
| ELK-01      | RICE COOKER | BUAH          |          20 |
| ELK-02      | LEMARI ES   | UNIT          |           8 |
| ELK-03      | TELEVISI    | UNIT          |          30 |
| ELK-04      | RADIO/TAPE  | BUAH          |          35 |
| ELK-05      | KOMPUTER    | UNIT          |          28 |
| ELK-06      | KIPAS ANGIN | BUAH          |          38 |
+-------------+-------------+---------------+-------------+
6 rows in set (0.000 sec)

MariaDB [(none)]>

 

No comments:

Post a Comment

Popular Posts