1

Installing and Configuring MySQL

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.

    About Abdul Khalique Siddique

    In addition to my proficiency in Oracle Database, I have also specialized in Oracle E-Business Suite. I have hands-on experience in implementing, configuring, and maintaining EBS applications, enabling organizations to streamline their business processes and achieve operational efficiency. Also I have hands-on experience in Oracle Cloud Infrastructure (OCI). I have worked with OCI services such as compute, storage, networking, and database offerings, leveraging the power of the cloud to deliver scalable and cost-effective solutions. My knowledge of OCI architecture and deployment models allows me to design and implement robust and secure cloud environments for various business requirements. Furthermore, I have specialized in disaster recovery solutions for Oracle technologies. I have designed and implemented comprehensive disaster recovery strategies, including backup and recovery procedures, standby databases, and high availability configurations. My expertise in data replication, failover mechanisms, and business continuity planning ensures that organizations can quickly recover from disruptions and maintain uninterrupted operations.

    Check Also

    Step-by-Step Guide to Convert Physical Standby to Snapshot Standby

    Complete Step-by-Step Guide to Convert Physical Standby to Snapshot Standby   Introduction Recently, I had …

    Leave a Reply