In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This script is used for MySQL binary installation and is limited to the initial installation. This script is not recommended if the server is already installed and configured with mysql.
Operating system version: CentOS 7
Database version: MySQL 5.7.22
#! / bin/bashcnf_file= "/ etc/my.cnf" install_log= "mysql_install.log" dbfile= "mysql-5.7.22-el7-x86_64.tar.gz" ext_files= "mysql-5.7.22-el7-x86_64" bin_path= "/ usr/local/mysql" pid_path= "/ data/mysql" data_path= "/ data/mysql/data" errlog_path= "/ data/mysql/logs/" binlog_path= "/ data/mysql/binlog/" slowlog _ path= "/ data/mysql/slow_logs" socket= "/ data/mysql/mysql3306.sock" port=3306serverid=330601group= "mysql" user= "mysql" if [!-f "$dbfile"] Thenecho "$dbfile not exists" > $install_logelsetar-zxvf $dbfile > $install_logif [$?-eq 0]; thenecho "$dbfile Extract Success" > > $install_logelseecho "$dbfile Extract Failed" > > $install_logexit 0fifiif [!-d "$bin_path"] Thenecho "moving $ext_files to $bin_path." > $install_logmv $ext_files $bin_pathecho "move $ext_files to $bin_path. [done]" > $install_logecho "creating $pid_path." > $install_logif [!-d "$pid_path"] Thenmkdir-p $pid_pathecho "create $pid_path. [done]" > $install_logelseecho "create $pid_path. [failed]" > > $install_logexit 0fiecho "creating $data_path." > $install_logif [!-d "$data_path"] Thenmkdir-p $data_pathecho "create $data_path. [done]" > $install_logelseecho "create $data_path. [failed]" > > $install_logexit 0fiecho "creating $errlog_path." > $install_logif [!-d "$errlog_path"] Thenmkdir-p $errlog_pathecho "create $errlog_path. [done]" > $install_logelseecho "create $errlog_path. [failed]" > > $install_logexit 0fiecho "creating $binlog_path." > $install_logif [!-d "$binlog_path"] Thenmkdir-p $binlog_pathecho "create $binlog_path. [done]" > $install_logelseecho "create $binlog_path. [failed]" > > $install_logexit 0fiecho "creating $slowlog_path." > $install_logif [!-d "$slowlog_path"] Thenmkdir-p $slowlog_pathecho "create $slowlog_path. [done]" > $install_logelseecho "create $slowlog_path. [failed]" > $install_logexit 0fielseecho "$bin_path already exists" > > $install_logexit 0fi#create group if not existsegrep "^ $group" / etc/group > & / dev/nullif [$?-ne 0] then echo "group $group not exists" > > $install_logecho "creating group $group." > > $install_loggroupadd $groupecho "creat group $group. . [done] "> $install_logelseecho" group $group already exists. [skip] "> $install_logfi#create user if not existsegrep" ^ $user "/ etc/passwd > & / dev/nullif [$?-ne 0] then echo" user $user not exists "> > $install_logecho" creating user $user. "> $install_loguseradd-g $group $userecho" creat user $user. [done] "> $install_logelseecho" user $user already exists. . [skip] "> $install_logfi#Modify directory permissionschown-R $user.$group $bin_pathchown-R $user.$group $pid_path#Add environment variablesresult_grep_path=" $(grep "${bin_path} / bin" / etc/profile) "| | result_grep_path="if [- z" ${result_grep_path} "] thenecho" export PATH=\ $PATH:$ {bin_path} / bin:$ {bin_path} / lib "> > / etc/profile Source / etc/profileelseecho "${bin_path} / bin already exists in / etc/profile" > > $install_logfi#mysql cnfif [- f $cnf_file] Thenecho "$cnf_file exists" echo "move $cnf_file to $cnf_ file`date'+% Y% m% d% H% M% S`date" > > $install_logmv $cnf_file $cnf_ file`date "+% Y%m%d%H%M%S" `ficat > / etc/my.cnf > $install_logelseecho "mysql initialize failed" > > $install_logexit 0ficp-a / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql.serverchmod + x / etc/rc.d/init.d/ Mysql.serverchkconfig-- add mysql.serverchkconfig-- list mysql.server > > $install_logsudo-u mysql service mysql.server start if [$?-eq 0] Thenecho "mysql install & & start success" > > $install_logelseecho "mysql install or start failed" > > $install_logfiexit 0
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.