Centos7.5 yumインストールmysql 5.7

5363 ワード

Centos7.5 yumでmysql 5をインストールする.7
 :    mysql5.7   mariadb-server

基礎環境の準備は、あまり説明しない前にドキュメントで詳しく説明しました.
[root@localhost ~]# hostname --all-ip
192.168.200.101 
[root@localhost ~]# firewall-cmd --stat
not running
[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
[root@localhost ~]# systemctl status iptables
● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@localhost ~]# ping -c 4 csdn.net
PING csdn.net (47.95.164.112) 56(84) bytes of data.
64 bytes from 47.95.164.112 (47.95.164.112): icmp_seq=1 ttl=128 time=6.91 ms
64 bytes from 47.95.164.112 (47.95.164.112): icmp_seq=2 ttl=128 time=5.52 ms
64 bytes from 47.95.164.112 (47.95.164.112): icmp_seq=3 ttl=128 time=7.51 ms
64 bytes from 47.95.164.112 (47.95.164.112): icmp_seq=4 ttl=128 time=5.27 ms

--- csdn.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 5.277/6.308/7.511/0.935 ms

mysql 5を構成する.7のyumソース
[root@localhost ~]# yum install -y http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# ll /etc/yum.repos.d/					//  mysql repo  
    24
drwxr-xr-x. 2 root root  187 9    3 15:45 bak
-rw-r--r--. 1 root root 2523 9    3 15:45 Centos-7.repo
-rw-r--r--. 1 root root  951 10   3 2017 epel.repo
-rw-r--r--. 1 root root 1050 10   3 2017 epel-testing.repo
-rw-r--r--. 1 root root 1245 9    3 15:53 mslinux.repo
-rw-r--r--  1 root root 1627 4    5 2017 mysql-community.repo
-rw-r--r--  1 root root 1663 4    5 2017 mysql-community-source.repo
[root@localhost ~]#yum -y install mysql-community-server
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since   2019-09-19 16:37:57 CST; 10s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 16398 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 16324 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 16401 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─16401 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

9  19 16:37:54 localhost.localdomain systemd[1]: Starting MySQL Server...
9  19 16:37:57 localhost.localdomain systemd[1]: Started MySQL Server.
[root@localhost ~]# systemctl enable mysqld
[root@localhost ~]# grep 'password' /var/log/mysqld.log 					//  mysql  
2019-09-19T08:37:54.700678Z 1 [Note] A temporary password is generated for root@localhost: gYD.1l>Gr47X
 :mysql5.7    root   mysql log 
[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.27

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> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> alter user 'root'@'localhost' identified by '123123';
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             | 4     |
| validate_password_mixed_case_count   | 1     |
| validate_password_number_count       | 1     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 1     |
+--------------------------------------+-------+
7 rows in set (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye


 :
validate_password_policy         validate_password      0-->low  1-->MEDIUM  2-->strong。

validate_password_length        (       4)。

validate_password_number_count           。

validate_password_mixed_case_count        。

validate_password_special_char_count          。

validate_password_dictionary_file     


     
 set global  xxx=num

mysql5.7配置が完成して、給油方法はいつも問題より多い!!!