MySQL under Linux system is a common database management system, mainly used to store and manage large amounts of data. Installing MySQL on Linux requires some skills. This article will mainly introduce how to install it through RPM.
1. Download the RPM of MySQL
Before installing MySQL, we need to download the MySQL RPM file suitable for our system from the official website. Visit the official website, find the RPM file of the corresponding version, and download it to your local hard drive.
2. Install MySQL RPM
After the download is completed, we can start installing MySQL. There are several installation methods:
sudo rpm -ivh MySQL-server-*.rpm
sudo rpm -Uvh MySQL-server-*.rpm
sudo rpm -ivh MySQL-client-.rpm MySQL-server-.rpm
This way you can install MySQL and Its a client too.
3. Configure MySQL
After the installation of MySQL is completed, let’s perform some simple configurations for it.
sudo systemctl start mysqld.service
sudo systemctl enable mysqld.service
MySQL does not have a password by default after the installation is completed. We need to set a password for it through the following command:
sudo /usr/bin/mysql_secure_installation
Press Enter to continue. You will be prompted to enter the current root user password. Because this is a newly installed MySQL, just enter the key here
Then the program will prompt you to enter the root user password, and then confirm the password again.
The program will then ask whether to delete the test database. For security reasons, you can choose to delete the test database.
mysql -u root -p
sudo systemctl stop mysqld .service
At this point, the MySQL installation and some simple configurations are completed. We can start using this database for data storage and management.
The above is the detailed content of How to install linux mysql through RPM. For more information, please follow other related articles on the PHP Chinese website!