It is recommended to run this command every time to update your MySQL/MariaDB from one major release to another. For example when upgrading from MySQL 5.7 to MySQL 8; MariaDB 10 to MariaDB 11. It checks all the databases(with all the tables) for any incompatibilities. It also updates the system tables with new privileges or options that might have been added in the new version.
The command with options is:
mysql_upgrade [--force] [--user=# --password --host=hostname --port=# --socket=# --protocol=tcp|socket|pipe|memory --verbose] OTHER_OPTIONS]
Simply run the command in shell:
root@www [/home]# mysql_upgrade