• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Saturday, June 14, 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 Install MySQL on Arch Linux

in Arch Linux, Linux OS
Installing MySQL on Arch Linux

MySQL is a widely used open-source relational database management system (RDBMS). It is an essential component for many web applications and content management systems like WordPress, Joomla, and Drupal. In this tutorial, we will guide you through the step-by-step process of how to install MySQL on Arch Linux system.

Table of Contents

  1. Prerequisites
  2. Updating Arch Linux
  3. Installing MySQL
  4. Securing MySQL Installation
  5. Testing MySQL Connection
  6. Conclusion

Prerequisites

Before you begin, ensure that you have:

  • Arch Linux installed on your system
  • Access to a user account with sudo privileges
  • A stable internet connection

How to Install MySQL on Arch Linux

Updating Arch Linux

It is always a good practice to update your Arch Linux system before installing any new packages. To update Arch Linux, open the terminal and execute the following command:

sudo pacman -Syu

Wait for the updates to finish, and then proceed to the next step.

Installing MySQL on Arch Linux

In Arch Linux, MySQL is available through the official repositories. To install MySQL, run the following command in your terminal:

sudo pacman -S mysql

This command will install the latest version of MySQL, along with its dependencies. Once the installation is complete, you need to initialize the MySQL data directory by running the following command:

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

After initializing the data directory, enable and start the MySQL service using the following commands:

sudo systemctl enable mysqld
sudo systemctl start mysqld

MySQL is now installed and running on your Arch Linux system. Next, we will secure the installation by running the mysql_secure_installation script.

Securing MySQL on Arch Linux

The mysql_secure_installation script helps you improve the security of your MySQL installation. It allows you to set a password for the root user, remove anonymous users, disable remote root login, and remove the test database. To run the script, execute the following command:

sudo mysql_secure_installation

The script will prompt you to enter a new password for the root user. Make sure to choose a strong password and remember it, as you will need it to access your MySQL server. Answer “Y” (yes) to all the following questions to complete the security setup:

  • Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
  • Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
  • Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
  • Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

Your MySQL installation is now secured. The next step is to test the connection to the MySQL server.

Testing MySQL Connection

To test the connection to your MySQL server, run the following command:

mysql -u root -p

When prompted, enter the password you set during the mysql_secure_installation process. If the connection is successful, you will see the MySQL shell prompt:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.28 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

You have now successfully connected to your MySQL server. You can execute SQL queries and manage your databases from the MySQL shell. To exit the MySQL shell, type the following command:

exit

Conclusion

Congratulations! You have successfully installed and secured MySQL on your Arch Linux system. MySQL is a powerful and versatile RDBMS that can handle various workloads and is widely used in web applications. To further enhance your skills in managing MySQL, consider learning how to set up a MySQL database server on Oracle Linux.

If you’re interested in exploring other databases, you can check out how to install MariaDB on Arch Linux as an alternative to MySQL. Additionally, you might find these Arch Linux tutorials helpful:

  • How to install TensorFlow on Arch Linux
  • How to install pip on Arch Linux
  • How to install Python on Arch Linux
  • How to install Nginx on Arch Linux
  • How to set up an Apache web server on Arch Linux
ShareTweet
Previous Post

How to Install MariaDB on Arch Linux

Next Post

How to Install PHP on Arch Linux

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

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.