Installing and Configuring MySQL 8.0 on Ubuntu for Production Use
In this blog, we will walk through the complete installation and basic production-level configuration of MySQL 8.0 on Ubuntu Linux.
The guide covers:
• Installing MySQL Server
• Securing the installation
• Understanding important MySQL directories
• Configuring performance and binary logging
• Enabling Point-in-Time Recovery (PITR)
• Creating databases and users
• Preparing a dedicated backup user for Commvault integration
Step 1: Update the Server
apt update
Step 2: Install MySQL Server
apt install -y mysql-server
Step 3: Secure the MySQL Installation
mysql_secure_installation
Step 4: Verify MySQL Service Status
systemctl status mysql
Important MySQL Default Directories
|
Purpose |
Path |
|
Data Directory |
/var/lib/mysql |
|
Configuration File |
/etc/mysql/mysql.conf.d/mysqld.cnf |
|
Logs |
/var/log/mysql/ |
|
Socket File |
/var/run/mysqld/mysqld.sock |
MySQL Configuration Parameters
[mysqld]bind-address = 0.0.0.0# InnoDB tuning
innodb_buffer_pool_size = 2G
innodb_log_file_size = 512M
innodb_flush_log_at_trx_commit = 1
# Binary logs (IMPORTANT for PITR)
log_bin = /var/log/mysql/mysql-bin
binlog_format = ROW
server-id = 1
expire_logs_days = 7
# Logging
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
Creating Database and Users
CREATE DATABASE test_mysql;
CREATE USER ‘testuser’@’%’ IDENTIFIED BY ‘Pass@123’;
GRANT ALL PRIVILEGES ON test_mysql.* TO ‘testuser’@’%’;
FLUSH PRIVILEGES;
Best Practices
- Restrict remote access to trusted IPs only.
- Use strong passwords in production environments.
- Enable firewall rules for port 3306.
- Configure regular backups and binary log retention.
- Monitor slow query logs regularly.
Conclusion
This setup provides a strong foundation for MySQL administration, backup strategies, replication, disaster recovery, and performance tuning.
Oracle Solutions We believe in delivering tangible results for our customers in a cost-effective manner