注意,本地开发机为了方便,端口全开
下载repo
打开http://dev.MysqL.com/downloads/repo/ 从这里下载对应的版本。
安装repo
sudo yum localinstall MysqL57-community-release-el7-11.noarch.rpm
安装MysqL-server
sudo yum install MysqL-server
启动MysqLd
sudo service MysqLd start
安装以后MysqL5.7会有一个默认的密码
我们通过这个语句获取到
cat /var/log/MysqLd.log | grep password
登录MysqL
首先需要用设置密码
set password = password('keep');
会提示信息
Your password does not satisfy the current policy requirements
然后我们需要设置一下密码验证策略,详细设置教程可以搜索上面的语句,我这里仅仅是本机,直接设置为最短
set global validate_password_policy=0; set global validate_password_length=1; set password = password('keep');
设置远程登录
set global validate_password_policy=0; set global validate_password_length=1; GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'keep' WITH GRANT OPTION; GRANT ALL ON *.* TO root@'localhost' IDENTIFIED BY 'keep' WITH GRANT OPTION; flush privileges;
设置bin-log
vim /etc/my.cnf 把log_bin前面的#去掉,再添加一个唯一的server-id log_bin server-id=888168
关闭防火墙
systemctl stop firewalld.service firewall-cmd --state