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.
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
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
Pause the MySQL service
# service mysqld stop
Uninstall the MySQL service
You need to remove all components. Please note that there may be dependencies in the order of components.
# rpm -ev [需要移除组件的名称]
or
# rpm -e --nodeps [需要移除组件的名称] //此命令为强制卸载
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
Install the mysql80-community-release-el7-1.noarch.rpm package
# sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
After the installation is completed, two files will be obtained in the /etc/yum.repos.d folder: mysql-community.repo && mysql-community-source.repo
##Use yum to install the mysql service# sudo yum install mysql-server
Complete!
# systemctl list-unit-files|grep mysqld
# systemctl enable mysqld.service
# ps -ef|grep mysql
# systemctl start mysqld.service
# mysqld --initialize
# grep 'temporary password' /var/log/mysqld.log
If a prompt appears when setting the password
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
set global validate_password.policy=0;
use mysql; #修改root账户权限 update user set host = '%' where user = 'root'; #刷新权限 flush privileges;
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!