I have a couple of Ubuntu 20.04 servers running on AWS, using MySQL 5.7 rather than 8.0.
When I set up the server I did some modifications to /etc/mysql/mysql.conf.d/mysqld.cnf and everything worked fine. This is what I did previously in 16.04.
But it seems that a subsequent update via apt overwrote my changes on both servers. What is the proper way to do this in 20.4?
The standard practice for MySQL configuration settings is to create a separate file in
/etc/mysql/mysql.conf.d/
. MySQL will read all.cnf
files in that directory alphabetically, so if there are settings you need to configure that may also exist in the default configuration files, you’ll need to give them a file name starting with lettern
or “higher”.Generally what I do with MySQL configurations is keep some defaults in a Git repository that I then copy to a new server as needed. Here are some examples:
z-replication.cnf
z-highmemory.cnf
z-pi.cnf
… and so on. By doing this, updates to MySQL do not interfere with my settings and vice versa.