Arch Linux BasedManjaro

How To Install MySQL on Manjaro

Install MySQL on Manjaro

In this tutorial, we will show you how to install MySQL on Manjaro. MySQL, an open-source relational database management system (RDBMS), is a cornerstone of modern web development and data management. Its versatility and robustness have made it a favorite among developers and database administrators alike. On the other hand, Manjaro Linux, an open-source Linux distribution based on Arch Linux, is celebrated for its user-friendliness and accessibility.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MySQL database on a Manjaro Linux.

Prerequisites

  • A server or desktop running one of the following operating systems: Manjaro, and other Arch-based distributions.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A stable internet connection is crucial for downloading and installing packages. Verify your connection before proceeding.
  • Access to a Manjaro Linux system with a non-root sudo user or root user.

Install MySQL on Manjaro

Step 1. Keeping your system updated is not just a best practice; it’s a necessity. Updates often include important security patches and functionality enhancements. On Manjaro Linux, system updates are managed by the pacman package manager. To update your system, open your terminal and enter the following command:

sudo pacman -Syu
sudo pacman -S base-devel

This command synchronizes your package database with the server‘s and upgrades all out-of-date packages.

Step 2. Installing MySQL on Manjaro.

With your system updated, you’re ready to install MySQL. The pacman package manager makes this process straightforward. To install MySQL, use the following command:

sudo pacman -S mysql

This command fetches the MySQL package from the official repository and installs it on your system. After the installation is complete, you can verify it by checking the MySQL version. Run the following command:

mysqld --version

This command should return the version of MySQL that you‘ve just installed.

Step 3. Configuring MySQL.

A fresh MySQL installation needs to be configured for security and functionality. MySQL provides a secure installation script that helps you secure your installation. Run the script with the following command:

sudo mysql_secure_installation

This script will guide you through several security settings, including setting a password for the MySQL root user, removing anonymous users, disabling remote root login, and removing the test database.

Next, you need to set up the MySQL service to start on boot. This ensures that MySQL is always available when your system starts. Use the systemctl command to enable the MySQL service:

sudo systemctl enable mysqld

To start the MySQL service immediately, use the command:

sudo systemctl start mysqld

Step 4. Create Database MySQL.

Additionally, you might want to create a new MySQL user and database. This can be done using the MySQL command-line client. Remember to replace ‘username‘ and ‘your-strong-password‘ with your desired username and password:

mysql -u root -p
CREATE USER 'username'@'localhost' IDENTIFIED BY 'your-strong-password';
CREATE DATABASE mydatabase;
GRANT ALL PRIVILEGES ON mydatabase.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
exit

Congratulations! You have successfully installed MySQL. Thanks for using this tutorial to install the latest version of the MySQL database on the Manjaro system. For additional help or useful information, we recommend you check the official MySQL website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button