centos6.9编译安装mysql-5.6.36
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.9编译安装mysql-5.6.36相关的知识,希望对你有一定的参考价值。
- 一 安装相关软件包
[[email protected] ~]# yum -y install ncureses-devel libaio-devel
[[email protected] tools]# yum install cmake –y - 创建mysql运行用户
[[email protected] tools]# useradd -s /sbin/nologin -M mysql - 下载软件包
[[email protected] tools]# wget https://downloads.mysql.com/archives/get/file/mysql-5.6.36.tar.gz -
解压软件
[[email protected] tools]# tar -xf mysql-5.6.36.tar.gz -
配置MySQL
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36
-DMYSQL_DATADIR=/application/mysql-5.6.36/data
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_EXTRA_CHARSETS=all
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITH_ZLIB=bundled
-DWITH_SSL=bundled
-DENABLED_LOCAL_INFILE=1
-DWITH_EMBEDDED_SERVER=1
-DENABLE_DOWNLOADS=1
-DWITH_DEBUG=0 - 创建软连接
ln -s /application/mysql-5.6.36/ /application/mysql - 拷贝配置文件到etc
cp support-files/my*.cnf /etc/my.cnf
8 . 初始化数据库
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
9.创建关键目录并授权
mkdir /application/mysql/tmp/
chown -R mysql.mysql /application/mysql/
10 . 拷贝启动脚本
cp support-files/mysql.server/etc/init.d/mysqld
chmod700 /etc/init.d/mysqld
11 . 设置开机自启
chkconfig mysqld on
chkconfig--list mysqld
12 .启动数据库
/etc/init.d/mysqld start
netstat -lntup|grep 3306
13 .设置环境变量
echo ‘PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile
source /etc/profile
echo $PATH
以上是关于centos6.9编译安装mysql-5.6.36的主要内容,如果未能解决你的问题,请参考以下文章