centos7安装mysql5.6(2018-10)
多参考官方文档:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
1.安装mysql的yum源
rpm包的地址参考:
https://dev.mysql.com/downloads/repo/yum/
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
rpm安装你下载的包
rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
2.安装mysql
列出可安装版本
yum repolist all | grep mysql
选择你要安装的版本更换为enable
sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql56-community/x86_64
yum install mysql-community-server
3.配置mysql
shell设置root密码,此命令仅对mysql5.6有效
mysql_secure_installation
登陆mysql
mysql -u root -p
授权任意IP远程以root身份访问
GRANT ALL PRIVILEGES ON *.* to 'root'@'%' IDENTIFIED BY '你的密码';
刷新
flushprivileges;
shell设置防火墙
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload