centos install mysql through yum

Preface##

I installed mysql according to the documentation on Oracle the day before yesterday, and selected the latest version 8.0. Later, some problems appeared. I searched for answers on the Internet. The basic solution was the 5.x version, and the 8.0 version was not applicable. Then I went to check the Alibaba Cloud rds version that I bought in the company's official environment, 5.7. In this case, it is necessary to reinstall 5.7 to keep it consistent with the official environment. However, I suddenly became a little curious about why version 6.0 or 7.0 was not installed at the time, after all, there were two major versions. What's even stranger is that I looked at the version list of mysql's official documentation and found that there is no 6.0 or 7.0 documentation.

This is fun, why not 6.x, 7.x.

Searched it online.

To the effect, 6 suddenly disappeared due to some performance issues. Then Oracle acquired Sun, stopped the development of 6, and then integrated 7 related functions into 8. Therefore, 8 has become the latest important version.

Let's Go Home##

Document [Address] (https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html), note that it is version 5.7.


Installation part###

It can be divided into the following steps:

  1. Uninstall the previous version. yum erase mysql

  1. Choose y, finish

  2. After completion, check if /etc/my.cnf and /etc/mysql still exist, they need to be deleted manually. It is found that there is an extra my.cnf.rpmsave, rpm helped save it, we don't need it here, and can delete it directly.

  3. libaio is a dependency of mysql, you can install it first (but it was not installed when 8.0 was installed last time, it should be installed automatically). libnuma is a dependency of NUMA function in mysql, so let's install it manually first.
    yum install libaio yum install libnuma

  4. Use Address to choose the version you need according to your own system. My system is centos7.5, so choose el7. Download to the server through wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm, save the address at any time. Although the name is mysql80, this just means that version 8.0 is enabled by default, which actually contains several versions. You can configure the specific version to be enabled later.

  5. sudo yum localinstall mysql80-community-release-el7-1.noarch.rpm First install the rpm configuration.

  6. yum repolist enabled | grep "mysql.*-community.*" to see if it has been added successfully.

  1. The version that comes out is still 8.0. Let's configure it to disable 8.0 and enable 5.7.
    sudo yum-config-manager --disable mysql80-community sudo yum-config-manager --enable mysql57-community
  2. Look at the version of yum enabled. yum repolist enabled | grep "mysql.*-community.*"

  1. Then you can install it. sudo yum install mysql-community-server, an error was reported. The 5.7 version of common is required, and the installation is indeed the 8.0 version of common.

  1. There should be two options for the above question

  2. Delete the installed 8.0 common

  3. Use the prompt --skip-broken parameter configuration to solve

  4. Try the first one first. yum erase mysql-community-common is deleted. Try the installation again. sudo yum install mysql-community-server. No error is reported, press y to continue the installation. done.

  5. Start the service. Centos7 recommends using systemctl start mysqld.service. Haha, it failed~~

  1. If it is a new installation, there should be no problem. Follow the prompts to see the error situation.

  1. Follow the prompts to search for the reasons. I searched it, and it was caused by the original installation of 8.0 and then the creation of data. Just delete it here. Then start the service, no error is reported.

  1. Look at the service status sudo systemctl status mysqld.service, running.

Settings section###

Divided into the following parts:

  1. When the mysql service is started for the first time, it will automatically do the following things.

  2. Start the service.

  3. Generate ssl certificate and secret key file in the data directory (/var/lib/mysql)

  4. Install and enable the validate_password plugin. This plugin is enabled by default. It requires a password of at least 8 characters, and requires one uppercase, one lowercase, one number, and one special character.

  5. The user 'root'@'localhost' is created, and the password is stored in /var/log/mysqld.log.

  6. Check the password. sudo grep'temporary password' /var/log/mysqld.log

  1. Log in with the temporary password, and then modify the temporary password. mysql -u root -p

  1. Successfully modified. Log in with the new password and try to see if the statement can be executed. no problem.

  1. Log in to mysql and create a user for remote login. CREATE USER'root1'@'%' IDENTIFIED WITH mysql_native_password BY'xxxxxxxxxx';. % Means that any address can be connected. xxx is a specific password, which must comply with the above password rules. The password verification method is mysql_native_password.

  1. Assign permissions below. grant all privileges on *.* to'root1'@'%' assign all permissions to root1 user. The first asterisk represents the database name. So in general, you can create a database with root first, and then assign all the permissions of this database to user root1. After the assignment, you need to refresh the permission configuration. FLUSH PRIVILEGES

  1. After creation, mysql uses port 3306 by default, so you need to turn on the server's port 3306 firewall. firewall-cmd --zone=public --add-port=3306/tcp --permanent, if the prompt FirewallD is not running indicates that the firewall server is not started, you can enable it or not. Then you need to reload the firewall configuration. firewall-cmd --reload
  2. After the local port is enabled, you need to set Alibaba Cloud security group rules.

  1. Then try to see if it can be connected remotely, here use dbeaver, cross-platform, Amway~

  1. Try to query the connection, create a table and other operations, and succeed.

That's it.

Recommended Posts

centos install mysql through yum
CentOS 7.2 Yum install MySQL 5.6
CentOS7.2 install Mysql5.7.13
CentOS7 install MySQL
CentOS install mysql
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
CentOS7 yum install and start mysql
CentOS Yum compile and install MySQL 5.6
CentOS7 yum install and start mysql
Centos yum install mysql5.6 or above
Centos7 YUM install MariaDB 10.0
CentOS yum install Apache + PHP + Tomcat7 + MySQL
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Install mysql5.7 under CentOS7
Centos7 install Mysql8 tutorial
Centos manually install mysql8
Install mysql under Centos 7
Centos7 install Mysql database
Centos7 YUM install MariaDB 10.0
Install mysql5.1 under CentOS6.5
CentOS7 system yum way to install MySQL5.7
Install svn and configuration through yum under CentOS
Install mysql online on centos
Install MySQL 8.0.16 on Linux Centos
Install MySQL under Linux (CentOS 7)
Centos6 install mysql 5.7.x series
CentOS 7 yum install PHP7.3 tutorial
CentOS8 install MySQL8 (pro test)
1.5 Install Centos7
How to install MySQL on CentOS 8
CentOS 7 install Nginx, PHP, MySQL packages
Install MySql with Docker in CentOS7
Install java in yum mode in Centos
Install MySQL on Linux CentOS7 (Windows)
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
centos7 .*tar package to install MySQL5.7
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS install Redmine
Centos7 install Python 3.6.
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS7.5 source code compile and install mysql5.7.29
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
Install mysql8.0.13 version under Linux CentOS7 system