centos8 install mysql8
1. Preparations
Configure centos domestic yum source reference official document
- 1. Backup:
mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 2. Download the new CentOS-Base.repo to /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
- 3. Modify the file CentOS-Linux-AppStream.repo
- View CentOS-Linux-BaseOS.repo
- Copy the contents of [AppStream] in CentOS-Linux-BaseOS.repo
- Replace the copied content with the content in CentOS-Linux-AppStream.repo
- 4. Run yum makecache to generate cache
yum makecache
2. Start the installation
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum module disable mysql
yum install mysql-community-server --nogpgcheck
3. mysql settings
-
start mysql
service mysqld start
-
check status
service mysqld status
-
Check the default password, find a place to remember to log in later
grep 'temporary password' /var/log/mysqld.log
-
enter mysql
mysql -u root -p
-
Set the password to 123456
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; flush privileges;
-
Modify localhost so that the host can connect
use mysql; update user set host = '%' where user = 'root'; flush privileges;
-
set root permissions
GRANT ALL ON *.* TO 'root'@'%' ; flush privileges;
-
quit
exit
-
restart mysql
service mysqld restart