These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Updating both PHP and MySQL is easy enough. I’ll guide you through the process, however I strongly suggest before updating MySQL to backup your droplet.
PHP
In this case rather than updating, you’ll just install a higher PHP version on your droplet.
Here are the steps, if you are on an Ubuntu.
Update Packages
Make sure your Ubuntu server is having the latest packages by running the following command.
If you are using Apache as your Web Service, you’ll need to install PHP like this
sudo apt install php7.3
Nginx
If you are using Nginx however, you’ll need to perform the following
sudo apt install php7.3-fpm
Extensions
PHP with it’s extensions is useless so you’ll need to install them regardless which Web Service you are using. The next command will include the most common extensions
Now let’s continue with updating MySQL.
Since you have decided to update it, I’ll strongly suggest going directly to MariaDB. Luckily, the process is indeed easy enough. Let’s start
Backup The first and most important step is to backup your databases. You can do so by using the following command
This will dump your database in a file called backupdb.sql in the directory you currently are.
Optionally you can create a backup of my.cnf file somewhere in your system as well
Remove MySQL
Like PHP, MySQL needs to be reinstalled to have a higher version.
Now we can uninstall the MySql server, associated utilities amd MySql user.
MySQL has been removed from your droplet
Installation
Now, going to the fun part, adding the updated software, in this case MariaDB 10.3.
First you need to add MariaDB repository on your system in order to Install MariaDB.
Once this has been covered, just in case run an update on your droplet and then continue with the installation
Once this has been completed, just start your MariaDB service like so
If this doesn’t work, try with
Ready for work
Finally, we have to import the previously exported databases back to MariaDB server as follows.
You are ready to go!
Regards, KDSys
Hi @jefflamer,
Updating both PHP and MySQL is easy enough. I’ll guide you through the process, however I strongly suggest before updating MySQL to backup your droplet.
PHP
In this case rather than updating, you’ll just install a higher PHP version on your droplet.
Here are the steps, if you are on an Ubuntu.
Update Packages
Make sure your Ubuntu server is having the latest packages by running the following command.
Add a repository for PHP 7.3
Apache
If you are using Apache as your Web Service, you’ll need to install PHP like this
Nginx
If you are using Nginx however, you’ll need to perform the following
Extensions
PHP with it’s extensions is useless so you’ll need to install them regardless which Web Service you are using. The next command will include the most common extensions
If you need to add another one, just type in
And you are ready, you now have the latest PHP version on your droplet.