Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Script sharing for mysql source code installation

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains the "mysql source code installation script sharing", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "mysql source code installation script sharing" bar!

The code is as follows:

#! / bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHclear SysName= "" SysBit= "" CpuNum= "" RamTotal= "" RamSwap= "" FileMax= "" MysqlVersion= "Percona-Server-5.6.15-rel63.0" MysqlLine= "http://www.percona.com/downloads/Percona-Server-5.6/LATEST/source"MysqlPath="/usr/local/mysql"MysqlDataPath="$MysqlPath/data"MysqlLogPath="/var/log/mysql"MysqlConfigPath="$MysqlPath/conf"MysqlPass="test123"SYSTEM_CHECK(){ [[$(id-u)! ='0']] & & echo'[Error] Please use root to install PUPPET.' & & exit Egrep-I "centos" / etc/issue & & SysName='centos'; egrep-I "ubuntu" / etc/issue & & SysName='ubuntu'; [["$SysName" = ='']] & & echo'[Error] Your system is not supported this script' & & exit; SysBit='32' & & [`getconf WORD_ BIT` = = '32'] & & [`getconf LONG_ BIT` = =' 64'] & & SysBit='64'; CpuNum= `cat / proc/cpuinfo | grep 'processor' | wc-l` RamTotal= `free-m | grep 'Mem' | awk' {print $2}'`; RamSwap= `free-m | grep 'Swap' | awk' {print $2}'`; FileMax= `cat / proc/sys/fs/file- max`} INSTALL_BASE_PACKAGES () {SYSTEM_CHECK if ["$SysName" = = 'centos'] Then echo'[yum-fastestmirror Installing] * * > >'; yum- y install yum-fastestmirror Cp / etc/yum.conf / etc/yum.conf.lnmp sed-I-I _ Yum-y install $packages; done; mv-f / etc/yum.conf.lnmp / etc/yum.conf; else apt-get remove-y mysql-client mysql-server mysql-common; apt-get update; for packages in gcc gathers + cmake make ntp logrotate cron bison libncurses5-dev libncurses5 libssl-dev openssl curl openssl Do echo "[${packages} Installing] * * > >"; apt-get install-y $packages-- force-yes;apt-get-fy install;apt-get-y autoremove; done; fi } INSTALL_MYSQL () {INSTALL_BASE_PACKAGES cd / tmp/ echo "[${MysqlVersion} Installing] * * >"; [!-f ${MysqlVersion} .tar.gz] & & wget-c ${MysqlLine} / ${MysqlVersion} .tar.gz tar-zxf / tmp/$MysqlVersion.tar.gz; cd / tmp/$MysqlVersion Groupadd mysql; useradd-s / sbin/nologin-g mysql mysql; cmake-DCMAKE_INSTALL_PREFIX=$MysqlPath-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_EXTRA_CHARSETS=complex-DWITH_READLINE=ON-DENABLED_LOCAL_INFILE=ON-DWITH_INNODB_MEMCACHED=ON-DWITH_UNIT_TESTS=OFF; make-j $Cpunum; make install; for path in $MysqlLogPath $MysqlPath $MysqlConfigPath/conf.d $MysqlDataPath;do [!-d $path] & & mkdir-p $path chmod 740$ path; chown-R mysql:mysql $path Done# EOF * * cat > $MysqlConfigPath/my.cnf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report