脚本宝典收集整理的这篇文章主要介绍了2.LNMP架构-MySQL源码包编译部署详细步骤,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
操作系统:CentOS-7.5-1804
操作步骤:
一、安装依赖组件
[[email protected] ~]# yum -y install ncurses ncurses-devel
[[email protected] ~]# rpm -qa | grep MysqL
[[email protected] ~]# rpm -e --nodeps qt-MysqL-4.8.7-2.el7.x86_64
[[email protected] ~]# rpm -e --nodeps akonadi-MysqL-1.9.2-4.el7.x86_64
[[email protected] ~]# rpm -qa | grep mariadb
[[email protected] ~]# rpm -e --nodeps mariadb-5.5.60-1.el7_5.x86_64
[[email protected] ~]# rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
[[email protected] ~]# rpm -e --nodeps mariadb-server-5.5.60-1.el7_5.x86_64
2.2.安装@R_711_1512@包
[[email protected] ~]# cd /usr/local/src/
[[email protected] src]# tar -xzf cmake-3.14.5.tar.gz -C /usr/local/data/
[[email protected] src]# cd /usr/local/data/cmake-3.14.5/
[[email protected] cmake-3.14.5]# ./bootstrap
[[email protected] cmake-3.14.5]# gmake
[[email protected] cmake-3.14.5]# make install
[[email protected] cmake-3.14.5]# echo ‘export PATH=$PATH:/usr/local/data/cmake/bin‘>>/etc/PRofile
[[email protected] cmake-3.14.5]# source /etc/profile
[[email protected] cmake-3.14.5]# cmake --version
3.3.安装boost包
[[email protected] ~]# cd /usr/local/src/
[[email protected] src]# tar -zxf boost_1_59_0.tar.gz -C /usr/local/data/
[[email protected] src]# cd /usr/local/data/
[[email protected] data]# mv boost_1_59_0/ boost
[[email protected] ~]# userdel MysqL
[[email protected] ~]# groupdel MysqL
[[email protected] ~]# groupadd MysqL
[[email protected] ~]# useradd -r -g MysqL MysqL
3.5.安装MysqL包
[[email protected] ~]# cd /usr/local/src/
[[email protected] src]# tar -xzf MysqL-5.7.26.tar.gz -C /usr/local/data/
[[email protected] src]# cd /usr/local/data/MysqL-5.7.26/
[[email protected] MysqL-5.7.26]#
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/data/MysqL \
-DMysqL_DATADIR=/usr/local/data/MysqL/data \
-DWITH_BOOST=/usr/local/data/boost \
-DWITH_INNOBASE_STORAGE_ENginE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISam_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EMBEDDED_SERVER=1
[[email protected] MysqL-5.7.26]# make
[[email protected] MysqL-5.7.26]# make install
3.6.授予配置权限
[[email protected] MysqL-5.7.26]# chown -R MysqL:MysqL /usr/local/data/MysqL
[[email protected] MysqL-5.7.26]# vim /etc/my.cnf
# For advice on how to change settings please see
# http://dev.MysqL.COM/doc/refman/5.7/en/server-configuration-defaults.htML
# *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the
# *** default location during install,and will be replaced if you
# *** upgrade to a newer version of MysqL.
[client]
port=3306
[MysqL]
default-character-set=utf8
[MysqLd]
port=3306
basedir=/usr/local/data/MysqL
datadir=/usr/local/data/MysqL/data
character-set-server=utf8
default-storage-engine=InnoDB
max_connections=512
lower_case_table_names=1
query_cache_size=0
tmp_table_size=18M
thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
innodb_flush_LOG_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SubSTITUTION
3.8.初始化MysqL
[[email protected] MysqL-5.7.26]#
/usr/local/data/MysqL/bin/MysqLd \
--initialize-insecure \
--user=MysqL \
--basedir=/usr/local/data/MysqL \
--datadir=/usr/local/data/MysqL/data
3.9.配置MysqL环境变量
[[email protected] MysqL-5.7.26]# vim /etc/profile
# MysqL environment
export MysqL_HOME=/usr/local/data/MysqL
export PATH=$PATH:$MysqL_HOME/bin
[[email protected] MysqL-5.7.26]# source /etc/profile
3.10.设置开机自启
[[email protected] MysqL-5.7.26]# cp /usr/local/data/MysqL/support-files/MysqL.server /etc/init.d/MysqLd
[[email protected] MysqL-5.7.26]# chmod +x /etc/init.d/MysqLd
[[email protected] MysqL-5.7.26]# chkconfig --add MysqLd
3.11.启动MysqL服务
[[email protected] MysqL-5.7.26]# MysqLd_safe --defaults-file=/etc/my.cnf &
3.12.查看MysqL进程
[[email protected] MysqL-5.7.26]# ps -ef | grep MysqL
[[email protected] MysqL-5.7.26]# MysqL -uroot
3.14.设置登陆密码
*自定义设置密码*
MysqL> SET password = password(‘********‘);
3.15.配置远程访问
MysqL> UPDATE user SET host = ‘%‘ WHERE user = ‘root‘;
MysqL> exit
[[email protected] MysqL-5.7.26]# /etc/init.d/MysqLd restart
以上是脚本宝典为你收集整理的2.LNMP架构-MySQL源码包编译部署详细步骤全部内容,希望文章能够帮你解决2.LNMP架构-MySQL源码包编译部署详细步骤所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。