It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.
Migrate the database from an old version to a new one
To migrate the database from an old version to a new one, follow these steps:
Launch a new MediaWiki cloud server instance.
Copy the database backup to the new server.
Stop all servers and start only MySQL.
$ sudo /opt/bitnami/ctlscript.sh stop $ sudo /opt/bitnami/ctlscript.sh start mysql
Remove the previous database and create the new one. You can configure the database user password with a secure password.
$ mysql -u root -p Password: **** mysql> drop database bitnami_mediawiki; mysql> create database bitnami_mediawiki; mysql> grant all privileges on bitnami_mediawiki.* to 'bn_mediawiki'@'localhost' identified by 'DATABASE_PASSWORD';
Restore the new database:
$ mysql -u root -p bitnami_mediawiki < backup.sql
Edit the MediWiki configuration file to update the database user password (the same that you set previously) at /opt/bitnami/apps/mediawiki/htdocs/LocalSettings.php:
$wgDBpassword = "DATABASE_PASSWORD";
Copy the /opt/bitnami/apps/mediawiki/htdocs/files directory from the old installation to the new one.
If you have installed plugins in the previous version, copy the folders from the vendor/plugins directory into the new installation directory, into the plugins directory.
Restart the servers.
$ sudo /opt/bitnami/ctlscript.sh restart
Upgrade the MediaWiki database
You can upgrade the MediaWiki database in two ways: from the command line or from the web browser (since version 1.17). Upgrading from the command line is recommended, since this reduces the risk of the upgrade process being interrupted by a timeout or connection reset.
Make sure that your web server (such as Apache) and your database sever (such as MySQL) are running.
From the command line execute:
$ cd /opt/bitnami/apps/mediawiki/htdocs $ php maintenance/update.php
MediaWiki will inspect the existing schema and update it to work with the new code, adding tables and columns as needed. If you use a shared database, you should pass the --doshared parameter if you want the shared tables to be updated. Otherwise they won’t be touched by the update script.
Web browser upgrade
NOTE: If your database is already large in size and in high production usage, then you should not be using the Web updater, as the update process might time out when the script’s maximum execution time is reached. In that case you should use the command-line interface (not from the web). Always backup before performing database maintenance.
Follow these steps:
Navigate your browser to /mw-config/. For example, if your wiki is at mydomain.com/mediawiki/Main_Page, then navigate to mydomain.com/mediawiki/mw-config/.
Select your language and click continue.
- The existing installation should be detected. Follow the instructions on the screen to upgrade it. If asked for the “upgrade key”, open /opt/bitnami/apps/mediawiki/htdocs/LocalSettings.php file and look for the key assigned to $wgUpgradeKey.