Skip to content

MySQL

Date:
czw., sie 7, 2025

Install and configure a MySQL server

sudo apt-get update

sudo apt-get upgrade

sudo apt install mysql-server

sudo service mysql status

The network status of the MySQL service can also be checked by running the ss command at the terminal prompt:

sudo ss -tap | grep mysql

If the server is not running correctly, you can type the following command to start it:

sudo service mysql restart

A good starting point for troubleshooting problems is the systemd journal, which can be accessed from the terminal prompt with this command:

sudo journalctl -u mysql

mysql -V

Configure MySQL

You can edit the files in

/etc/mysql/

to configure the basic settings – log file, port number, etc.

For example, to configure MySQL to listen for connections from network hosts, in the file

/etc/mysql/mysql.conf.d/mysqld.cnf

Percona Xtrabackup

Also supported in Ubuntu 24.04 LTS and later, Percona Xtrabackup is a tool for creating physical backups. It is similar to the commercial offering of MySQL Enterprise Backup.

completely get rid of your MySQL installation

In order to completely get rid of your MySQL installation you could run the following:

Make sure MySQL is not running:

sudo systemctl stop mysql

Then purge all of the MySQL packages:

sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*

Then delete all of the MySQL files:

sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql

Finally clean all packages that are not needed:

sudo apt autoremove

sudo apt autoclean