https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/html
https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[root@localhost bin]# cd /home/download [root@localhost download]# ll 總用量 210228 -rw-r--r--. 1 root root 194990602 5月 6 15:32 jdk-8u211-linux-x64.tar.gz -rw-r--r--. 1 root root 26024 5月 6 16:07 mysql80-community-release-el7-3.noarch.rpm -rw-r--r--. 1 root root 1014040 11月 6 23:26 nginx-1.14.1.tar.gz -rw-r--r--. 1 root root 19231911 5月 17 2018 zookeeper-3.5.4-beta.tar.gz
[root@localhost download]# rpm -Uvh mysql80-community-release-el7-3.noarch.rpm 警告:mysql80-community-release-el7-3.noarch.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY 準備中... ################################# [100%] 正在升級/安裝... 1:mysql80-community-release-el7-3 ################################# [100%]
[root@localhost download]# yum repolist all | grep mysql mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community 禁用 mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - So 禁用 mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community 禁用 mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - So 禁用 mysql-cluster-8.0-community/x86_64 MySQL Cluster 8.0 Community 禁用 mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - So 禁用 mysql-connectors-community/x86_64 MySQL Connectors Community 啓用: 108 mysql-connectors-community-source MySQL Connectors Community - Sou 禁用 mysql-tools-community/x86_64 MySQL Tools Community 啓用: 89 mysql-tools-community-source MySQL Tools Community - Source 禁用 mysql-tools-preview/x86_64 MySQL Tools Preview 禁用 mysql-tools-preview-source MySQL Tools Preview - Source 禁用 mysql55-community/x86_64 MySQL 5.5 Community Server 禁用 mysql55-community-source MySQL 5.5 Community Server - Sou 禁用 mysql56-community/x86_64 MySQL 5.6 Community Server 禁用 mysql56-community-source MySQL 5.6 Community Server - Sou 禁用 mysql57-community/x86_64 MySQL 5.7 Community Server 禁用 mysql57-community-source MySQL 5.7 Community Server - Sou 禁用 mysql80-community/x86_64 MySQL 8.0 Community Server 啓用: 99 mysql80-community-source MySQL 8.0 Community Server - Sou 禁用
[root@localhost download]# sudo yum-config-manager --disable mysql80-community [root@localhost download]# sudo yum-config-manager --enable mysql57-community
[root@localhost download]# yum repolist enabled | grep mysql mysql-connectors-community/x86_64 MySQL Connectors Community 108 mysql-tools-community/x86_64 MySQL Tools Community 89 mysql57-community/x86_64 MySQL 5.7 Community Server 347
yum install mysql-community-server 依賴關係解決 ================================================================================================================================================================================================================================================= Package 架構 版本 源 大小 ================================================================================================================================================================================================================================================= 正在安裝: mysql-community-libs x86_64 5.7.26-1.el7 mysql57-community 2.2 M 替換 mariadb-libs.x86_64 1:5.5.56-2.el7 mysql-community-libs-compat x86_64 5.7.26-1.el7 mysql57-community 2.0 M 替換 mariadb-libs.x86_64 1:5.5.56-2.el7 mysql-community-server x86_64 5.7.26-1.el7 mysql57-community 166 M 爲依賴而安裝: mysql-community-client x86_64 5.7.26-1.el7 mysql57-community 24 M mysql-community-common x86_64 5.7.26-1.el7 mysql57-community 274 k 爲依賴而更新: postfix x86_64 2:2.10.1-7.el7 base 2.4 M 事務概要 ================================================================================================================================================================================================================================================= 安裝 3 軟件包 (+2 依賴軟件包) 升級 ( 1 依賴軟件包) 總下載量:197 M Is this ok [y/d/N]: y Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. 警告:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.26-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY ] 171 kB/s | 1.0 MB 00:19:29 ETA mysql-community-common-5.7.26-1.el7.x86_64.rpm 的公鑰還沒有安裝 (1/6): mysql-community-common-5.7.26-1.el7.x86_64.rpm | 274 kB 00:00:06 (2/6): mysql-community-libs-5.7.26-1.el7.x86_64.rpm | 2.2 MB 00:00:05 (3/6): mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm | 2.0 MB 00:00:13 (4/6): postfix-2.10.1-7.el7.x86_64.rpm
[root@localhost home]# service mysqld start Redirecting to /bin/systemctl start mysqld.service [root@localhost home]# service mysqld status Redirecting to /bin/systemctl status mysqld.service ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since 一 2019-05-06 16:41:58 CST; 23s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 2818 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 2744 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 2821 (mysqld) CGroup: /system.slice/mysqld.service └─2821 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid 5月 06 16:41:48 localhost.localdomain systemd[1]: Starting MySQL Server... 5月 06 16:41:58 localhost.localdomain systemd[1]: Started MySQL Server.
[root@localhost home]# grep 'temporary password' /var/log/mysqld.log 2019-05-06T08:41:48.727949Z 1 [Note] A temporary password is generated for root@localhost: r#qtUrwlo22E [root@localhost home]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.26 Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123123'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> SHOW VARIABLES LIKE 'validate_password%' -> ; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | OFF | | validate_password_dictionary_file | | | validate_password_length | 8 | | validate_password_mixed_case_count | 1 | | validate_password_number_count | 1 | | validate_password_policy | MEDIUM | | validate_password_special_char_count | 1 | +--------------------------------------+--------+ 7 rows in set (0.01 sec) mysql> set global validate_password_length=6 -> ; Query OK, 0 rows affected (0.00 sec) mysql> SHOW VARIABLES LIKE 'validate_password%' -> ; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | OFF | | validate_password_dictionary_file | | | validate_password_length | 6 | | validate_password_mixed_case_count | 1 | | validate_password_number_count | 1 | | validate_password_policy | MEDIUM | | validate_password_special_char_count | 1 | +--------------------------------------+--------+ 7 rows in set (0.00 sec) mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123123'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements mysql> set global validate_password_policy=LOW; Query OK, 0 rows affected (0.00 sec) mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123123'; Query OK, 0 rows affected (0.00 sec)
[root@localhost home]# firewall-cmd --zone=public --add-port=3306/tcp --permanent success [root@localhost home]# firewall-cmd --reload success
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123123' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec)