MySQL大型分布式集群(一)-centos7.3yum安装mysql5.7

摘要: centos7.3yum安装mysql

最小化安装centos7.3

服务器规划(说明: 配置静态IP请查看关于上篇环境配置的博客)

1
2
192.168.241.101 paascloud-mysql-001
192.168.241.102 paascloud-mysql-002

1.下载yum源 我这里版本为5.7

1
下载地址: https://dev.mysql.com/downloads/file/?id=470281

查看yum源安装mysql版本

1
2
3
[root@paascloud-mysql-001]# yum localinstall mysql57-community-release-el7-11.noarch.rpm
[root@paascloud-mysql-001 soft]# vim /etc/yum.repos.d/mysql-community.repo
[root@paascloud-mysql-001 soft]# yum install -y mysql-community-server

注意: 把需要下载的版本对应的enabled改成1 这里默认下载5.7

启动mysql

1
2
[root@paascloud-mysql-001 yum.repos.d]# systemctl status mysqld.service
[root@paascloud-mysql-001 yum.repos.d]# systemctl start mysqld.service

查看mysql密码

1
2
3
4
5
[root@paascloud-mysql-001 yum.repos.d]# cat /etc/my.cnf
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@paascloud-mysql-001 yum.repos.d]# more /var/log/mysqld.log
2017-08-23T11:42:20.569786Z 1 [Note] A temporary password is generated for root@localhost: vrwrge#&4/oA

登录mysql数据库

1
输入上面查到的密码可以登录.到此mysql安装完毕!

配置密码

修改密钥复杂度配置

1
2
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=6;

修改密码

1
mysql> alter user 'root'@'localhost' identified by '123456';

远程访问

1
2
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> flush privileges;
评论