centos7 mysql8.0 installation method

藏色散人
Release: 2020-11-06 17:42:19
Original
10651 people have browsed it

centos7 Mysql8.0 installation method: First uninstall the historical version of MySQL; then use the command "sudo yum install mysql-server" to install MySQL; finally set it to start at boot.

centos7 mysql8.0 installation method

Recommendation: "centos tutorial"

CentOS 7 Installation of MySQL8.0

1. Uninstall the historical version of MySQL

Check whether you have the historical version

If you are not installing for the first time, you need to uninstall the historical version of MySQL. Use the command to check whether the historical version of MySQL component is installed

# rpm -qa|grep mysql
Copy after login

centos7 mysql8.0 installation method

For example, two installed MySQL Community Edition components are queried in the picture. Before installing the new version of MySQL, you need to remove the installed historical components

Check the MySQL service status

# service mysqld status
Copy after login

Pause the MySQL service

# service mysqld stop
Copy after login

Uninstall the MySQL service

You need to remove all components. Please note that there may be dependencies in the order of components.

# rpm -ev [需要移除组件的名称]
Copy after login

or

# rpm -e --nodeps [需要移除组件的名称] //此命令为强制卸载
Copy after login

2. Install MySQL

Use rpm to install MySQL

Because the default database installed by CentOS 7 is Mariadb, use the YUM command MySQL cannot be installed, only Mariadb will be updated. Use rpm to install. You can right-click the mysql repo source warehouse to copy the specified version of the database.

# wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
Copy after login

Install the mysql80-community-release-el7-1.noarch.rpm package

# sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
Copy after login

After the installation is completed, two files will be obtained in the /etc/yum.repos.d folder: mysql-community.repo && mysql-community-source.repo

centos7 mysql8.0 installation method

##Use yum to install the mysql service

# sudo yum install mysql-server
Copy after login

If the following content is displayed, the installation is successful

Complete!
Copy after login

Check whether it has been set to start the MySQL service at boot

# systemctl list-unit-files|grep mysqld
Copy after login

If

centos7 mysql8.0 installation method

is displayed, it means that it has been set to start at boot. If it is not set to start at boot If it is started, execute

# systemctl enable mysqld.service
Copy after login

Check if MySQL is started. If it is not started, execute the start service command

Check if the MySQL service is started

# ps -ef|grep mysql
Copy after login

Start the service

# systemctl start mysqld.service
Copy after login

Initialize MySQL

# mysqld --initialize
Copy after login

View MySQL initial default password

# grep 'temporary password' /var/log/mysqld.log
Copy after login

centos7 mysql8.0 installation method

Copy the password behind root@localhost:. Log in to mysql and paste the default password

Because of the changes in MySQL8.0, the password must be reset

alter user 'root'@'localhost' identified by '12345678';

If a prompt appears when setting the password

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Copy after login

It means you need to lower the policy level before executing

set global validate_password.policy=0;
Copy after login

Open the MySQL remote connection

use mysql; #修改root账户权限 update user set host = '%' where user = 'root'; #刷新权限 flush privileges;
Copy after login

The above is the detailed content of centos7 mysql8.0 installation method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
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!