Home  >  Article  >  Computer Tutorials  >  How to install MySQL on Manjaro

How to install MySQL on Manjaro

PHPz
PHPzforward
2024-02-19 14:10:021034browse

MySQL is an open source relational database management system (RDBMS) that plays an important role in modern web development and data management. Its versatility and robustness are favored by developers and database administrators. Manjaro Linux, on the other hand, is an open source Linux distribution built on Arch Linux and is known for its user-friendliness and ease of use.

如何在 Manjaro 上安装 MySQL

Installing MySQL on Manjaro

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

sudo pacman -Syu
sudo pacman -S base-devel

This command synchronizes the package database with the server's package database and upgrades all expired packages.

Step 2. Install MySQL on Manjaro.

After updating the system, you can install MySQL. pacman The package manager makes this process simple and straightforward. To install MySQL, use the following command:

sudo pacman -S mysql

This command gets the MySQL package from the official repository and installs it on your system. Once 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 you just installed.

Step 3. Configure MySQL.

In order to ensure security and functionality, it is recommended to perform a new installation and configuration of MySQL. MySQL provides a secure installation script to assist you in completing the installation process.

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 logins, and deleting the test database.

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

sudo systemctl enable mysqld

To start the MySQL service immediately, use the following command:

sudo systemctl start mysqld

Step 4. Create database MySQL.

Additionally, you may wish to create new MySQL users and databases. 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

. Thank you for using this tutorial to install the latest version of MySQL database on your Manjaro system. For more help or useful information, we recommend checking out the official MySQL website.

The above is the detailed content of How to install MySQL on Manjaro. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete