Home >Database >Mysql Tutorial >How to install MYSQL on CentOS 6

How to install MYSQL on CentOS 6

PHPz
PHPzOriginal
2023-04-19 15:21:091181browse

CentOS 6 is a widely used operating system that can be used for many different applications. Installing MYSQL, a popular relational database management system, is one of the common tasks of CentOS installation. Below is a simple guide to help you install MYSQL on CentOS 6.

Step One: Preparation

Before you start installing MYSQL, you need to ensure that some dependencies have been installed on the system. First, you need to install wget. Wget is a command line tool for downloading files from the web. It can be installed using the following command:

yum install wget -y

Next, install an additional repository called "epel-release". It contains a large number of packages that are not included in the default CentOS repository. You can install it using the following command:

yum install epel-release -y

Step 2: Install MYSQL

Now you can install MYSQL directly using the yum package manager. Run the following command:

yum install mysql-server -y

This will install the MYSQL server and set it as the system startup item. After the installation is complete, start the MYSQL service:

service mysqld start

Step 3: Security settings

After completing the MYSQL installation, set some security settings to prevent unnecessary access. The MYSQL security script can be run using the following command:

mysql_secure_installation

The script will prompt you to set the MYSQL root account password and make some other security settings. Follow the on-screen instructions to complete the operation.

Step 4: Test MYSQL

Finally, test whether MYSQL is installed correctly and running. You can connect to the MYSQL server using the following command:

mysql -u root -p

Enter the root user password you set earlier. If all goes well, you will see a MYSQL command prompt as shown below:

mysql>

In Here, you can run various MYSQL commands and manage your database!

Summary

In this article, we have provided a simple guide for installing MYSQL on CentOS 6. After completing these steps, you should have successfully installed one of the world's most popular relational database management systems and have security settings set up to protect you from potential attacks. Happy coding!

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn