标签:安全套 wget 程序 相对 机器 google 5.6 ystemd init
第一章 编译安装数据库https://downloads.mysql.com/archives/get/file/mysql-5.6.40.tar.gz
yum install -y gcc gcc-c++ automake autoconf
yum -y install cmake bison-devel ncurses-devel libaio-devel
#程序存放位置
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql#数据存放位置
-DMYSQL_DATADIR=/application/mysql-5.6.38/data #socket文件存放位置
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.38/tmp/mysql.sock #使用utf8字符集
-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 #启用zlib库支持(zib、gzib相关)
-DWITH_ZLIB=bundled #启用SSL库支持(安全套接层)
-DWITH_SSL=bundled #启用本地数据导入支持
-DENABLED_LOCAL_INFILE=1 #编译嵌入式服务器支持
-DWITH_EMBEDDED_SERVER=1 # mysql5.6支持了google的c++mock框架了,允许下载,否则会安装报错。
-DENABLE_DOWNLOADS=1 #禁用debug(默认为禁用)
-DWITH_DEBUG=0
groupadd mysql
useradd -g mysql -s /sbin/nologin -M mysql
ln -s /usr/local/mysql-5.6.40/ /usr/local/mysql
chown mysql:mysql /usr/local/mysql-5.6.40
\cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
[root@db100 local]# tar cf /root/mysql.tar mysql-5.6.40/
scp /root/mysql.tar root@10.0.0.52:/usr/local/
scp /etc/profile /etc/my.cnf root@10.0.0.52:/etc/
scp /etc/profile /etc/my.cnf root@10.0.0.53:/etc/
scp /etc/init.d/mysqld root@10.0.0.53:/etc/init.d
groupadd mysql
useradd -g mysql -s /sbin/nologin -M mysql
ln -s /usr/local/mysql-5.6.40/ /usr/local/mysql
chown mysql:mysql /usr/local/mysql
/etc/init.d/mysqld start
[root@db01 ~]# mkdir /application
wget https://downloads.mysql.com/archives/get/file/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
[root@db01 ~]# mv mysql-5.6.40-linux-glibc2.12-x86_64 /application/mysql-5.6.40
[root@db01 scripts]# ln -s /application/mysql-5.6.40/ /application/mysql
[root@db01 ~]# useradd mysql -s /sbin/nologin –M
[root@db01 ~]#chown –R mysql:mysql /application/mysql-5.6.40
[root@db01 ~]# cd /application/mysql-5.6.40/support-files
[root@db01 support-files]# cp my-default.cnf /etc/my.cnf
[root@db01 support-files]# cp mysql.server /etc/init.d/mysqld
[root@db01 scripts]# cd /application/mysql-5.6.40/scripts
[root@db01 scripts]# ./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
--user 指定mysql用户
--basedir 指定mysql安装目录
--datadir 指定mysql数据目录
[root@db01 scripts]# sed -i ‘s#/usr/local#/application#g‘ /etc/init.d/mysql /application/mysql/bin/mysqld_safe
[root@db01 scripts]# /etc/init.d/mysqld start
[root@db01 scripts]# echo ‘export PATH="/application/mysql/bin:$PATH"‘ > /etc/profile.d/mysql.sh
[root@db01 scripts]# source /etc/profile
[root@db01 scripts]# vim /etc/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
/etc/init.d/mysqld start
标签:安全套 wget 程序 相对 机器 google 5.6 ystemd init
原文地址:http://blog.51cto.com/14083743/2320164