• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Friday, May 23, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Set Up a MySQL Database Server on AlmaLinux: Step-by-Step Guide

in Almalinux
How to Set Up a MySQL Database Server on AlmaLinux: Step-by-Step Guide

AlmaLinux is a free, open-source, community-driven Linux distribution designed as a drop-in replacement for CentOS. It is a stable, reliable, and secure operating system that is well-suited for running database servers. MySQL is a popular open-source relational database management system that is widely used in web applications. In this blog, we will discuss How to Set Up a MySQL Database Server on AlmaLinux.

Step-1: Update the System Before starting the installation process

It is recommended to update the system to ensure that all packages are up-to-date. To update the system, open the terminal and type the following command:

sudo yum update

Step-2: Install MySQL To install MySQL on AlmaLinux

You can use the default package manager, yum. Type the following command in the terminal to install MySQL:

sudo yum install mysql-server

Step-3: Start the MySQL Service Once the installation is complete

Start the MySQL service by typing the following command:

sudo systemctl start mysqld

Step-4: Secure MySQL Installation By default

MySQL installation is not secure. To secure the MySQL installation, run the mysql_secure_installation script by typing the following command:

sudo mysql_secure_installation

This script will prompt you to configure the following settings:

  • Set the root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

Follow the instructions on the screen and answer the questions to secure the MySQL installation.

Step-5: Configure MySQL By default

MySQL listens on localhost, which means it can only be accessed from the same machine. If you want to access MySQL from other machines, you need to configure it to listen on a specific IP address or on all interfaces. To do this, open the MySQL configuration file using your favorite text editor:

sudo vi /etc/my.cnf

Add the following line under the [mysqld] section to listen on all interfaces:

bind-address = 0.0.0.0

Alternatively, you can specify a specific IP address by replacing 0.0.0.0 with the IP address.

Save and close the file, then restart the MySQL service for the changes to take effect:

sudo systemctl restart mysqld

Step-6: Create a MySQL User and Database

Now that MySQL is installed and configured, you can create a user and database for your application. To create a new database, log in to MySQL as the root user by typing the following command:

mysql -u root -p

Enter the root password when prompted.

Create a new database by typing the following command:

CREATE DATABASE dbname;

Replace dbname with the name of your database.

Create a new user and grant privileges to the database by typing the following command:

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

Replace username and password with the desired username and password.

Grant all privileges on the database to the user by typing the following command:

GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost';

Replace dbname and username with the name of your database and the username you just created.

Exit MySQL by typing the following command:

exit

Congratulations! You have successfully set up a MySQL database server on AlmaLinux. You can now use the database for your applications.

How to Set Up a Web Server on AlmaLinux Using Nginx

ShareTweet
Previous Post

How to Configure and Manage Storage Devices in AlmaLinux using LVM: A Step-by-Step Guide

Next Post

How to Install and Configure Virtualization Software with KVM on AlmaLinux

Related Posts

AlmaLinux for Developers

AlmaLinux for Developers: Essential Tools and Best Practices

How to Install Plesk on AlmaLinux 8

How to Install Plesk on AlmaLinux 8

How to Install CWP on AlmaLinux

How to Install CWP on AlmaLinux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.