[root@localhost~]#vim/etc/yum.repos.d/mysql.repo新建mysql的yum文件
[mysql56-community]
name=MySQL5.6CommunityServer
baseurl=/yum/mysql-5.6-community/el/6/$basearch/
gpgcheck=0
wq保存退出![root@localhost~]#yumrepolistenabled|grepmysql验证mysql的yum是否正确
mysql56-communityMySQL5.6CommunityServer335
[root@localhost~]#yumcleanall
[root@localhost~]#yuminstallmysql-community-servermysql-community-client.x86_64安装mysql
[root@localhost~]#servicemysqldstart开启mysql[root@localhost~]#/usr/bin/mysql_secure_installation初始化mysql
Entercurrentpasswordforroot(enterfornone):回车确定
Setrootpassword?[Y/n]Y确定
Newpassword:设置mysql的root密码
Re-enternewpassword:重复输入设置mysql的root密码
Passwordupdatedsuccessfully!
Reloadingprivilegetables..
...Success!
Removeanonymoususers?[Y/n]Y
...Success!
Disallowrootloginremotely?[Y/n]Y
...Success!
Removetestdatabaseandaccesstoit?[Y/n]Y
...Success!
Reloadprivilegetablesnow?[Y/n]Y
...Success!
到此,mysql安装结束.....