本文探讨在CentOS 7.4上用yum方式来安装和配置Mysql 5.6。全文如下。
1. 清理CentOS7下的MariaDB
CentOS 7中自带了MariaDB,把它给卸载掉。
# rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
# rpm -e --nodepsmariadb-libs-5.5.56-2.el7.x86_64
2. download MySQL 的yum包
# wgethttp://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
#rpm-ivhmysql-community-release-el7-5.noarch.rpm
# yum repolist enabled | grep "mysql.*-community.*"
Repository epel is listed more than once in the configuration
mysql-connectors-community/x86_64 MySQL Connectors Community 42
mysql-tools-community/x86_64 MySQL Tools Community 55
mysql56-community/x86_64 MySQL 5.6 Community Server 361
3. 安装Mysql 5.6
#yuminstallmysql-community-server
....
安装过程中会提示依赖安装,选择Y就可以了。
4. Mysql启动
systemctl enable mysqld.service
systemctl start mysqld
systemctl status mysqld
5.mysql 安全配置
#mysql_secure_installation
6. 其它安装(可选的)
安装 MySQL Workbench工具
yum install mysql-workbench-community
7.定制化Mysql
yum装的mysql在一些情况下,不能安装我们实际的要求。故需要定制化。Mysql的配置文件是/etc/my.cnf
修改 文件 /etc/my.cnf即可。
至于mysql 性能调优,则可以参考下面的文档:
1) mysql服务性能优化—my.cnf配置说明详解(16G内存)
http://www.jb51.cc/article/p-tatbcrrv-bmg.html
官方安装参考文档如下:
https://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html