MySQL, a robust and widely used relational database management system, serves as a cornerstone for many applications and systems. Installing it on Arch Linux, a rolling release distribution known for its flexibility and cutting-edge features, requires a few steps to ensure a smooth setup. Follow this comprehensive guide to install and configure MySQL on your Arch-based system.
Step 1: Update System
Before proceeding with the installation, ensure your system is up-to-date. Open a terminal and execute the following command:
Step 2: Install MySQL
Install MySQL from the official repository using the pacman package manager:
Step 3: Verify Installation
Confirm the installation by checking the MySQL version:
Step 4: Initialize MySQL
Initialize the MySQL data directory before starting the server:
Step 5: Start MySQL
Initiate the MySQL server using systemctl:
sudo systemctl status mysqld
Step 6: Enable MySQL
Enable MySQL to start on system boot:
Configuring MySQL
Step 1: Secure Installation
Run the MySQL security installation script to configure security settings:
Step 2: Log into MySQL
Access the MySQL command-line interface as the root user:
Step 3: Create User
Create a new MySQL user with the desired username and password:
Step 4: Grant Privileges
Grant all privileges to the newly created user:
Step 5: Flush Privileges
Flush privileges to apply the changes and exit MySQL:
exit
Step 6: Log in with New User
Log in to MySQL with the newly created user:
Step 7: Create Database
Create a new database for your application:
Step 8: Verify Databases
List all available databases to verify the successful creation:
Congratulations! You have now successfully installed and configured MySQL on your Arch Linux system. You’re ready to leverage the power of MySQL for your applications and projects.