一、背景介绍
MySQL5.7系列出来N久,可是当前很多涉世未深的小伙伴连安装部署都不会,今天正好有点空闲时间,将mysql5.7的各种安装方式带小伙伴们走一遍,顺便也提升下自己,如果有需要可以参考下哦(⊙o⊙)哦!!!
我们都知道,软件安装一般常用的有yum、编译、二进制 方式,那么现在大家坐好老司机准备开车了啊。
二、YUM安装MySQL5.7
2.1 yum安装
[root@linux-node1 ~]# cd /usr/local/src/
[root@linux-node1 src]# yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
[root@linux-node1 src]# yum -y install mysql-community-server mysql-community-devel
注:如有问题请检查服务器上是否有冲突文件<rpm命令连接:https://www.runoob.com/linux/linux-yum.html>
2.2 初始化
[root@linux-node1 ~]# systemctl start mysqld
[root@linux-node1 ~]# systemctl enable mysqld
[root@linux-node1 ~]# grep "password" /var/log/mysqld.log #查看初始密码,需要启动后才能查看
[root@linux-node1 src]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
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>
2.3 修改密码
[root@linux-node1 src]#mysql -uroot -p'eZa?x2q;&;l%'
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxx';