centos7.4 mysql5.6 源码安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7.4 mysql5.6 源码安装相关的知识,希望对你有一定的参考价值。
一 mysql5.6 安装
1.1 安装网络yum源
[[email protected] ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] ~]# yum -y install epel-release
[[email protected] ~]# yum clean all && yum makecache
1.2 依赖环境安装
[[email protected] ~]# yum -y install cmake bison git ncurses-devel gcc gcc-c++
1.3 安装mysql5.6
[[email protected] ~]# rpm -qa | grep mariadb*
mariadb-libs-5.5.56-2.el7.x86_64
[[email protected] ~]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
[[email protected] ~]# groupadd mysql
[[email protected] ~]# useradd mysql -g mysql
[[email protected] ~]# tar xf mysql-5.6.38.tar.gz
[[email protected] ~]# mkdir /usr/local/mysql
[[email protected] ~]# mkdir /usr/local/mysql/data
[[email protected] ~]# cd mysql-5.6.38
[[email protected] mysql-5.6.38]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DENABLE_DOWNLOADS=1
[[email protected] mysql-5.6.38]# make && make install
如果此过程出现error,则执行命令
# rm -rf /opt/mysql-5.6.38/CMakeCache.txt
[[email protected] mysql-5.6.38]# chown -R mysql:mysql /usr/local/mysql/data/
[[email protected] mysql-5.6.38]# chown -R mysql:mysql /usr/local/mysql/
[[email protected] ~]# cd /usr/local/mysql/
[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
报错:
FATAL ERROR: please install the following Perl modules before executing scripts/mysql_install_db:
Data::Dumper
[[email protected] mysql]# rpm -ivh /mnt/Packages/perl-Data-Dumper-2.145-3.el7.x86_64.rpm
[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
[[email protected] ~]# chown -R mysql:mysql /usr/local/mysql/
[[email protected] ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[[email protected] ~]# /etc/init.d/mysql start
[[email protected] ~]# vim /etc/profile
...
export PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
[[email protected] ~]# source /etc/profile
连接测试
以上是关于centos7.4 mysql5.6 源码安装的主要内容,如果未能解决你的问题,请参考以下文章
mysql5.7和mysql5.6同在CentOS7.4安装差异对比之5.6.40