安装yum源
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
安装rpm包
yum -y install mysql57-community-release-el7-10.noarch.rpm
安装
yum -y install mysql-community-server
启动
systemctl start mysqld.service
查看启动的服务
systemctl status mysqld.service
查看初始密码
grep "password" /var/log/mysqld.log 2019-11-25T12:02:44.304248Z 1 [Note] A temporary password is generated for root@localhost: ,b-Ppr.lt1R6
登陆服务器,修改密码
[xiaoxin@iZ2zee6df2m25shq6mfaw5Z ~]$ mysql -uroot -p,b-Ppr.lt1R6 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.28 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 'root2758'; ###密码设置的过于简单,得设置复杂一点 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'XIAOXIN@root2758'; ####复杂一点 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 | 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.00 sec)
因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉
yum -y remove mysql57-community-release-el7-10.noarch
查看版本
mysql> SHOW VARIABLES WHERE Variable_name = 'version'; +---------------+--------+ | Variable_name | Value | +---------------+--------+ | version | 5.7.28 | +---------------+--------+ 1 row in set (0.00 sec)
继续阅读
- 我的QQ
- QQ扫一扫
-
- 我的头条
- 头条扫一扫
-
评论