标签:hat mysq orm inux long 地址 object 端口号 nod
mysql-1:10.0.0.101
?
mysql-2:10.0.0.102
?
centos 6.9
[root@mysql-1 3306]# cat /etc/redhat-release
CentOS release 6.9 (Final)
关闭iptables和selinux
安装mysql-5.6.36
##安装前期准备
#1、创建安装目录及软件包下载目录
[ -e /tools ]||mkdir -p /tools
[ -e /application ]||mkdir -p /application
#2、创建mysql的虚拟用户mysql
useradd mysql -M -s /sbin/nologin
##源码编译安装
#1、安装依赖
yum install -y ncurese-devel libaio-devel
#2、安装cmake
yum install -y cmake
#3、下载mysql-5.6.36 cd /tools目录
下载地址:https://www.mysql.com/downloads/
#4、解压mysql-5.6.36
cd /tools
tar xf mysql-5.6.36.tar.gz
#5、进入mysql-5-6-36的目录源码编译安装
cd /tools/mysql-5.6.26
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
?
make && make install
?
##配置和启用
#1、创建软连接
ln -s /application/mysql-5.6.36 /application/mysql
#2、拷贝配置文件到/etc
\cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
#3、初始化数据库
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
#4、创建相关命令并授权
#创建mysql.sock所在目录/application/mysql/tmp并授权mysql的属主和属组
mkdir -p /application/mysql/tmp
chown -R /application/mysql/tmp
#创建mysql的数据存放目录/application/mysql/data并授权mysql的属主和属组
mkdir