MySQL5.7安装
1.安装rpm包环境
[root@harbor02#>> ~]#yum install -y https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
2.安装MySQL5.7
[root@harbor02#>> ~]#yum install mysql-community-server.x86_64 mysql-devel
3.启动
[root@harbor02#>> ~]#systemctl start mysqld.service
4.查找登录密码
[root@harbor02#>> ~]#cat /var/log/mysqld.log |grep password
2018-09-14T17:02:01.956752Z 1 [Note] A temporary password is generated for root@localhost: dMF!iOrrF2i;
5.登录
[root@harbor02#>> ~]#mysql -h 127.0.0.1 -uroot -p
6.修改密码
mysql> set password for root@localhost = password('A-bc789456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
7.修改默认字符集
# vim /etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
不建议操作
1.自己测试环境不想设置太负载密码可以关闭密码复杂度要求
# 查找mysqld 命令路径
[root@server_node01#>> /usr/local/src]#which mysqld
/usr/sbin/mysqld
# 查找该安装包
[root@server_node01#>> /usr/local/src]#rpm -qf /usr/sbin/mysqld
mysql-community-server-5.7.24-1.el7.x86_64
# 查找mysqld 的配置文件 my.cnf
[root@server_node01#>> /usr/local/src]#rpm -ql mysql-community-server-5.7.24-1.el7.x86_64 |grep my.cnf
/etc/my.cnf
2.修改my.cnf
# 末尾处添加策略为 off
[mysqld]
validate_password=off
3.重启mysqld 重新登录即可修改简单密码
[root@server_node01#>> /usr/local/src]#systemctl restart mysqld.service