本文共 1944 字,大约阅读时间需要 6 分钟。
一 mysql5.6 安装
1.1 安装网络yum源
[root@mysql ~]# yum -y install epel-release
[root@mysql ~]# yum clean all && yum makecache
1.2 依赖环境安装
[root@mysql ~]# yum -y install cmake bison git ncurses-devel gcc gcc-c++
1.3 安装mysql5.6
[root@mysql ~]# rpm -qa | grep mariadb*
mariadb-libs-5.5.56-2.el7.x86_64
[root@mysql ~]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
[root@mysql ~]# groupadd mysql
[root@mysql ~]# useradd mysql -g mysql
[root@mysql ~]# tar xf mysql-5.6.38.tar.gz
[root@mysql ~]# mkdir /usr/local/mysql
[root@mysql ~]# mkdir /usr/local/mysql/data
[root@mysql ~]# cd mysql-5.6.38
[root@mysql 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
[root@mysql mysql-5.6.38]# make && make install
如果此过程出现error,则执行命令
# rm -rf /opt/mysql-5.6.38/CMakeCache.txt
[root@mysql mysql-5.6.38]# chown -R mysql:mysql /usr/local/mysql/data/
[root@mysql mysql-5.6.38]# chown -R mysql:mysql /usr/local/mysql/
[root@mysql ~]# cd /usr/local/mysql/
[root@mysql 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
[root@mysql mysql]# rpm -ivh /mnt/Packages/perl-Data-Dumper-2.145-3.el7.x86_64.rpm
[root@mysql mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
[root@mysql ~]# chown -R mysql:mysql /usr/local/mysql/
[root@mysql ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@mysql ~]# /etc/init.d/mysql start
[root@mysql ~]# vim /etc/profile
...
export PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
[root@mysql ~]# source /etc/profile
连接测试
转载地址:http://jytnx.baihongyu.com/