Install Mysql under centos7 (notes)

I want to use the Mysql database on the local machine and the Mysql database on the virtual machine to build a mycat read-write separation, so install Mysql on the centos7 virtual machine, and now record the whole process, which is equivalent to reviewing it by myself during the recording process. Once again, deepen the impression.

First of all: Make sure that your virtual machine can ping the external network. You can try to ping www.baidu.com. If there is data returned, it means that you can connect to the external network, then you can use the yum command. (I will not go into details about how the virtual machine pings the external network. I also tried to get it on Baidu myself before, and then solved it. If there is time, I will write the process out).

Next comes the topic:

1. First delete the mariadb that comes with centos7. Use the command to view the mariadb that comes with it

rpm -qa | grep mariadb

2. Delete the files about mariadb

Command: rpm -e --nodeps + file name (you can directly copy the displayed file name and append it to the back, not to demonstrate one by one)

3. Download the required installation package:

命令:wgethttp://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

 

4. Check whether the installation source is installed successfully:

命令:yum repolist enabled | grep "mysql.*-community.*"


5. Check if the configuration parameters in this file are correct

Command: vim /etc/yum.repos.d/mysql-community.repo 

Modify the configuration according to the mysql version you installed. Generally, you do not need to modify it. Set the enabled value of the corresponding version to 1, and the other settings to 0. For example, I installed 5.7, and the file is modified as follows:


6. Install the mysql service (if mariadb was not uninstalled before, it was unsuccessful when I installed it in this step, and I uninstalled it later, because mariadb was overwritten during installation, and there will be some problems with mine):

Order:

To view the status of the service, command:


The display is as follows, indicating that the service started successfully:


At this point, the installation of the mysql database in the virtual machine centos7 has come to an end. Next, I will continue to build my mycat read-write separation demo and use the code test Smileto make a record of my learning in this article.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325509028&siteId=291194637