阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 7.2下RPM方式安装MySQL5.6

192次阅读
没有评论

共计 3330 个字符,预计需要花费 9 分钟才能阅读完成。

Linux 环境 RPM 安装 MySQL5.6 步骤记录。

系统环境 CentOS7.2

1. 关闭 selinux 服务【SELinux 是一种基于域 - 类型 模型(domain-type)的强制访问控制(MAC)安全系统】
[root@linuxidc ~]# vim /etc/selinux/config
···
SELINUX=disabled
···

2. 关闭防火墙服务,并且禁用开机启动
[root@linuxidc ~]# systemctl stop firewalld.service
[root@linuxidc ~]# systemctl disable firewalld.service

3. 关闭 NetworkManager 服务,并且禁用开机启动【(NetworManager) 是检测网络、自动连接网络的程序】
[root@linuxidc ~]# systemctl stop NetworkManager.service
[root@linuxidc ~]# systemctl disable NetworkManager.service

4. 检查系统是否安装有 mysql 的安装包,如果有使用 rpm -e 移除
[root@linuxidc ~]# rpm -qa| grep mysql

5. 下载 mysql5.6 的安装包,并上传到服务器上
[root@linuxidc mysql]# ll
total 236180
-rw-r–r– 1 root root 20278972 Sep 22 15:41 MySQL-client-5.6.31-1.el7.x86_64.rpm
-rw-r–r– 1 root root  3529244 Sep 22 15:40 MySQL-devel-5.6.31-1.el7.x86_64.rpm
-rw-r–r– 1 root root 92246408 Sep 22 15:44 MySQL-embedded-5.6.31-1.el7.x86_64.rpm
-rw-r–r– 1 root root 61732192 Sep 22 15:42 MySQL-server-5.6.31-1.el7.x86_64.rpm
-rw-r–r– 1 root root  2101912 Sep 22 15:42 MySQL-shared-5.6.31-1.el7.x86_64.rpm
-rw-r–r– 1 root root  2299648 Sep 22 15:40 MySQL-shared-compat-5.6.31-1.el7.x86_64.rpm
-rw-r–r– 1 root root 59644132 Sep 22 15:40 MySQL-test-5.6.31-1.el7.x86_64.rpm

6. 安装 mysql 的安装包
[root@linuxidc mysql]# rpm -ivh MySQL-server-5.6.31-1.el7.x86_64.rpm
[root@linuxidc mysql]# rpm -ivh MySQL-devel-5.6.31-1.el7.x86_64.rpm
[root@linuxidc mysql]# rpm -ivh MySQL-client-5.6.31-1.el7.x86_64.rpm

7. 修改 my.cnf 配置文件位置
[root@linuxidc ~]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

8. 修改字符集和数据存储路径 配置 /etc/my.cnf 文件, 设置如下键值来启用一起有用的选项和 UTF-8 字符集.
[root@linuxidc ~]# cat /etc/my.cnf
[mysqld]
···
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

9. 初始化 MySQL 及设置密码
[root@linuxidc ~]# /usr/bin/mysql_install_db
[root@linuxidc ~]# service mysql start
[root@linuxidc ~]# cat /root/.mysql_secret
# The random password set for the root user at Mon Dec 26 20:43:34 2016 (local time): 1dwIOrYEiaPsCyTM
[root@linuxidc ~]# mysql -uroot -p1dwIOrYEiaPsCyTM
mysql> SET PASSWORD = PASSWORD(‘abcd1234’);
Query OK, 0 rows affected (0.00 sec)

10. 设置 mysql 开机启动
[root@linuxidc ~]# systemctl restart mysqld.service
[root@linuxidc ~]# systemctl enable mysqld.service

11. 设置 mysql 允许远程登陆

 

12. 安装 mysql 出现安装包不兼容问题
[root@linuxidc mysql]# rpm -ivh MySQL-server-5.6.31-1.el7.x86_64.rpm
warning: MySQL-server-5.6.31-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                          ################################# [100%]
        file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
        file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
        file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64

解决方法,删除不兼容安装包
[root@linuxidc mysql]# rpm -qa |grep mariadb*
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@linuxidc mysql]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64(有依赖包,建议使用 yum 移除)
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
[root@linuxidc mysql]# yum remove mariadb-libs* -y

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-02/140795.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计3330字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中