Cleaning up my ubuntu 16.04 server after migrating database to a dedicated server.

July 21, 2018 260 views
Apache MySQL PHP Ubuntu 16.04

Hello there! (:

After fiddling around for a few hours, after getting inspired by DO's newsletter about the types of server setups that exist, I've decided that it'd be better to migrate the database to begin with. Especially, after I've read that the percona branch of mysql is proven to be a lot better suited to the application I'm running.

Long story short, there were plenty of reasons to go for a dedicated DB server now, rather than later.

Thus, I've tried around for a few hours and got it working.

1) I however noticed that my /etc/php folder now offers 5.6,7.0 and 7.2 "mods-available" folders, additionally to the complete 7.1 folder, which is the php version in use.

I'd like to clean those folders up but am unsure whether or not deleting these folders will break anything.

2) I still have phpmyadmin and mysql installed on my webserver. I've already disabled the mysql service and thus verified that the website works without the old db.

But I'm pretty sure that there are certain parts of the mysql package that are needed for my webserver to access the Database on the db server. mysql-client (?)

Some reasurrance on what is safe to delete would be highly appreciated.

1 Answer
rufio July 22, 2018
Accepted Answer

Just to be on the safe side, you should take a snapshot of the server as it is today. That way if you delete anything important, you can always restore back to the working snapshot.

  1. Not sure about the other versions of php

  2. PHPMyAdmin/MySQL - You can uninstall phpmyadmin from your app server, or if you still want to use it, you can update the phpmyadmin config to point at your remote mysql db. (You probably don't have Apache/PHP installed on your database server.)

PHP connects to your MySQL database using the mysql improved extension, that works the same whether the database is on the same server or not. This means you don't need to keep mysql installed on your app server.

This tutorial section might help give more context: https://www.digitalocean.com/community/tutorials/building-for-production-web-applications-deploying#set-up-database-server

by Mitchell Anicas
In this part of the "Building for Production: Web Applications" series (2 of 6), we will deploy our example PHP application, WordPress, and a private DNS. Your users will access your application over HTTPS via a domain name, e.g. "https://www.example.com", that points to the load balancer. The load balancer will act as a reverse proxy to the application servers, which will connect to the database server.
Have another answer? Share your knowledge.