[root@localhost user]# yum install mysql-server
已安装:
mysql-community-libs.x86_64 0:5.7.19-1.el7
mysql-community-libs-compat.x86_64 0:5.7.19-1.el7
mysql-community-server.x86_64 0:5.7.19-1.el7
作为依赖被安装:
mysql-community-client.x86_64 0:5.7.19-1.el7
mysql-community-common.x86_64 0:5.7.19-1.el7
替代:
mariadb-libs.x86_64 1:5.5.52-1.el7
完毕!
[root@localhost log]# systemctl start mysqld
[root@localhost log]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 二 2017-09-19 12:26:39 ULAST; 3s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 6371 ExecStart=/usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 6281 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 6374 (mysqld)
CGroup: /system.slice/mysqld.service
└─6374 /usr/sbin/mysqld –daemonize –pid-file=/var/run/mysqld/mysqld.pid…
9月 19 12:26:28 localhost.localdomain systemd[1]: Starting MySQL Server…
9月 19 12:26:39 localhost.localdomain systemd[1]: Started MySQL Server.
在mysqld.log中找寻临时密码
[root@localhost log]# cat mysqld.log |grep ‘pass’
2017-09-19T03:26:33.792174Z 1 [Note] A temporary password is generated for root@localhost: jtQNa+aXq6f+
[root@localhost log]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19
Copyright (c) 2000, 2017, 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)
//将密码策略由MEDIUM改成LOW
mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)
//将密码长度由8字符改成4字符
mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘123456’;
Query OK, 0 rows affected (0.01 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.07 sec)
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| sys |
+——————–+
4 rows in set (0.04 sec)
mysql> exit
Bye