Complete guide to installing MySQL database server on Ubuntu 22.04 with production-ready configuration.
Set up MySQL database server on Ubuntu 22.04 with optimal configuration for production use.
sudo apt update
sudo apt install mysql-server -y
sudo mysql_secure_installation
Configure MySQL by editing /etc/mysql/mysql.conf.d/mysqld.cnf:
max_connections = 200
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
sudo mysql
CREATE DATABASE myapp;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON myapp.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
Adjust innodb_buffer_pool_size to 70-80% of available RAM for optimal performance. Enable query cache for read-heavy workloads.
Use mysqldump for logical backups or Percona XtraBackup for hot backups without downtime.
Configuration guides for web servers, databases, and system services
View all articles