MySQL is a popular open source database management system suitable for a variety of applications and websites. CentOS is a popular Linux operating system used in many server applications. In this article, we will discuss how to install MySQL on CentOS.
Step 1: Update the Linux system
Before installing MySQL, you first need to update the Linux system. To do this, open a terminal and enter the following command:
sudo yum update
This will install all available CentOS components and updates.
Step 2: Install the MySQL service
To install the MySQL service on CentOS, you need to use the yum package manager. Enter the following command in the terminal:
sudo yum install mysql-server
This will start the MySQL installation process. Follow the command line prompts to complete the installation.
Step 3: Start the MySQL service
After the installation is complete, you need to start the MySQL service. Enter the following command in the terminal:
sudo systemctl start mysqld
This will start the MySQL service. To ensure that MySQL starts automatically on boot, run the following command:
sudo systemctl enable mysqld
Step 4: Set the MySQL root account password
During the MySQL installation process, a random password will be automatically created for the root account. password. To view this password, enter the following command in the terminal:
sudo grep 'temporary password' /var/log/mysqld.log
This will display the random password created by MySQL. Copy this password and enter the following command in the terminal:
sudo mysql_secure_installation
This command will guide you through the MySQL secure installation. You will first be asked to enter the random password you found earlier. Afterwards, you will be asked to set a new MySQL root password.
Step 5: Test MySQL
After installing and configuring the MySQL service, you need to test whether it is working properly. To do this, enter the following command:
sudo mysql -u root -p
This will prompt you for your MySQL root password. After entering your password, you will be taken to the MySQL command line.
In the MySQL command line, enter the following command to test whether MySQL is working properly:
SHOW DATABASES;
If MySQL is running properly, you should be able to see some output.
Conclusion
MySQL is a popular open source database management system that can be easily installed and configured on CentOS. This article provides installation steps and necessary commands to help you get started using the database.
The above is the detailed content of mysql installation tutorial centos. For more information, please follow other related articles on the PHP Chinese website!
What is the difference between eclipse and idea?
How to read text files in html
How to remove the watermark of Douyin account from downloaded videos from Douyin
WeChat restore chat history
How to resolve WerFault.exe application error
Introduction to frequency converter maintenance methods
The role of vga interface
How to enable the same city function on Douyin