centos7.4系统中yum源安装mysql 5.6
系统环境:centos7.4
一,查看是否安装有数据库:
yumlistinstalled|grepmysqld/mariadb
二,安装centos7系统带有mysql5.6安装包的yum源RPM资源包:
rpm-Uvhhttp://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm yumcleanall yumrepolist
三,安装msyql5.6:
yum-yinstallmysql-community-server
四,启动服务:
systemctlstartmysqld systemctlenablemysqld
五,重置密码:是具体情况而定(可以省略,无密码登陆)
#mysql_secure_installation Setrootpassword?[Y/n]y[设置root用户密码] Removeanonymoususers?[Y/n]y[删除匿名用户] Disallowrootloginremotely?[Y/n]n[禁止root远程登录] Removetestdatabaseandaccesstoit?[Y/n]y[删除test数据库] Reloadprivilegetablesnow?[Y/n]y[刷新权限]
六,查看mysql版本:
mysql-V mysqlVer14.14Distrib5.6.39,forLinux(x86_64)usingEditLinewrapper
七,验证:(无密码)
mysql-uroot-p密码
八、设置密码和远程权限
数据库密码设置:#setpasswordfor'root'@'localhost'=password('userpasswd');
九、配置防火墙
firewall-cmd--zone=public--add-port=3306/tcp--permanent