Home > Database > Mysql Tutorial > body text

centos rpm mysql installation

WBOY
Release: 2023-05-11 21:18:09
Original
796 people have browsed it

RPM installation of MySQL under CentOS

MySQL is one of the most popular open source relational database software in the world. It has the advantages of mature technical architecture, high reliability and ease of use. It is an ideal choice for building large-scale applications. , website, system essential components. This article will introduce the installation of MySQL using RPM packages under CentOS systems.

1. Download the MySQL RPM package

Before installing MySQL, you need to download the RPM package first. You can download the version suitable for your system from the official website https://dev.mysql.com/downloads/mysql/, for example, choose mysql-8.0.22-1.el7.x86_64.rpm-bundle.tar. After unzipping, you can get the following five RPM packages:

  • mysql-community-client-8.0.22-1.el7.x86_64.rpm
  • mysql-community-common-8.0. 22-1.el7.x86_64.rpm
  • mysql-community-devel-8.0.22-1.el7.x86_64.rpm
  • mysql-community-libs-8.0.22-1. el7.x86_64.rpm
  • mysql-community-server-8.0.22-1.el7.x86_64.rpm

2. Install the MySQL RPM package

Download After the RPM package is ready, use the following command to install it:

sudo rpm -ivh mysql-community-common-8.0.22-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-libs-8.0.22-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-client-8.0.22-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-devel-8.0.22-1.el7.x86_64.rpm
sudo rpm -ivh mysql-community-server-8.0.22-1.el7.x86_64.rpm
Copy after login

The above command will install the RPM package that MySQL depends on and the final MySQL server RPM package in order.

3. Start the MySQL service

After the installation is complete, run the following command to start the MySQL service:

systemctl start mysqld
Copy after login

4. Modify the MySQL password

After starting the MySQL service , initial configuration is required. By default, the MySQL root user does not have a password and we need to set a password for it. You can use the following command to set it up:

sudo mysql_secure_installation
Copy after login

After executing this command, follow the prompts to enter the password of the root user, choose whether to delete anonymous users, whether to prohibit root remote login, whether to delete the test database and access rights, and whether Reload the authorization table, etc., and finally set the root user's password.

5. Log in to the MySQL server

After completing the initial configuration, you can log in to the MySQL server through the following command:

mysql -u root -p
Copy after login

Then you will be prompted to enter the root user password, enter it correctly After entering the password, you can successfully log in to the MySQL server.

6. Uninstall MySQL

If you need to uninstall MySQL, you can use the following command:

sudo rpm -e mysql-community-server
sudo rpm -e mysql-community-devel
sudo rpm -e mysql-community-client
sudo rpm -e mysql-community-libs
sudo rpm -e mysql-community-common
Copy after login

The above command will uninstall the RPM package that MySQL depends on and the final MySQL server in order. After uninstalling the RPM package, you can delete the MySQL configuration file and data storage directory:

sudo rm -rf /etc/my.cnf
sudo rm -rf /var/lib/mysql
Copy after login

Related warnings

1. Before starting to install and use MySQL, please make sure you have logged in to the system as the root user .

2. After completing the installation of the RPM package, please remember to start the MySQL service and set the password for the root user in time.

3. For the security of the system, it is recommended to set the password of the mysql user.

4. If you need to uninstall MySQL, please back up your data before uninstalling it.

Reference materials:

https://www.mysql.com/

https://dev.mysql.com/doc/refman/8.0/en/linux -installation-rpm.html

https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

The above is the detailed content of centos rpm mysql installation. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!