Home > Article > Operation and Maintenance > centos7 mysql8.0 installation method
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-serverIf the following content is displayed, the installation is successful
Complete!Check whether it has been set to start the MySQL service at boot
# systemctl list-unit-files|grep mysqldIf 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.serviceCheck if MySQL is started. If it is not started, execute the start service command Check if the MySQL service is started
# ps -ef|grep mysqlStart the service
# systemctl start mysqld.serviceInitialize MySQL
# mysqld --initializeView MySQL initial default password
# grep 'temporary password' /var/log/mysqld.logCopy the password behind root@localhost:. Log in to mysql and paste the default passwordBecause of the changes in MySQL8.0, the password must be resetalter 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 requirementsIt means you need to lower the policy level before executing
set global validate_password.policy=0;Open the MySQL remote connection
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!