In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces to you through a simple script to achieve the start and stop of MYSQL, the contents of the article are carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand the start and stop of MYSQL through a simple script.
For MYSQL with multiple instance installations, the start and stop process is relatively complex, and some simple scripts can be defined to simplify day-to-day management.
Environment variable script
[mysql@mysql01 scripts] $cat mysql_env.ini#set envMYSQL_USER=rootMYSQL_PASS='password123' # password saved in plaintext, of course, cannot be used in the production library. COPYDIR='/opt/mysql'BASEDIR='/data/mysqldata'#check parameterif [$#-eq 0] then MYSQL_PORT=3306else MYSQL_PORT=$ 1fi [MySQL @ mysql01 scripts] $
MYSQL startup script
[mysql@mysql01 scripts] $cat mysqlstarted startup.shangxue binram bashsource / data/mysqldata/scripts/mysql_env.iniecho "Startup MySQL Service: localhost_" ${MYSQL_PORT} ${COPYDIR} / bin/mysqld_safe-- defaults-file=$ {BASEDIR} / ${MYSQL_PORT} / my.cnf & [mysql@mysql01 scripts] $
Stop script for MYSQL
[mysql@mysql01 scripts] $cat mysqlstores shutdown.shangxinxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Quick landing
[mysql@mysql01 scripts] $cat mysqlcmd.shangxinxinxinxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"establish a soft connection
[mysql@mysql01 scripts] $pwd/data/mysqldata/scripts [mysql@mysql01 scripts] $ln-s mysqlcmd.sh mysqlcmd [mysql@mysql01 scripts] $ln-s mysql_startup.sh mysqlstart [mysql@mysql01 scripts] $ln-s mysql_shutdown.sh mysqlstop [mysql@mysql01 scripts] $ls-ralttotal 32drwxr-xr-x. 5 mysql mysql 44 Aug 27 03:33.-rwxrw-r--. 1 mysql mysql 189 Aug 28 20:14 mysql_startup.sh-rwxrw-r--. 1 mysql mysql 220 Aug 28 20:19 mysql_shutdown.sh-rwxrw-r--. 1 mysql mysql 202 Aug 28 20:23 mysqlcmd.sh-rw-r--r--. 1 mysql mysql 12288 Aug 28 20:26 .mysql _ shutdown.sh.swp-rw-rw----. 1 mysql mysql 176 Aug 28 20:26 mysql_env.inilrwxrwxrwx. 1 mysql mysql 11 Aug 28 20:30 mysqlcmd-> mysqlcmd.shlrwxrwxrwx. 1 mysql mysql 16 Aug 28 20:30 mysqlstart-> mysql_startup.shlrwxrwxrwx. 1 mysql mysql 17 Aug 28 20:31 mysqlstop-> mysql_shutdown.sh
The process of using
6. Identify the currently running MYSQL instances, divided by port
[mysql@mysql01 scripts] $netstat-lnt | grep 330tcp6 0 0:: 3306: * LISTEN
You can see that 3306 is currently running, stop 3306
6. Stop MYSQL
[mysql@mysql01 scripts] $mysqlstop 3306Shutdown MySQL Service: localhost_3306Warning: Using a password on the command line interface can be insecure. [mysql@mysql01 scripts] $
6. Launch MYSQL
[mysql@mysql01 scripts] $mysqlstart 3306Startup MySQL Service: localhost_3306 [mysql@mysql01 scripts] $180828 21:33:49 mysqld_safe Logging to'/ data/mysqldata/3306/data/../mysql-error.log'.180828 21:33:49 mysqld_safe Starting mysqld daemon with databases from / data/mysqldata/3306/data [mysql@mysql01 scripts] $
6. Using MYSQL
[mysql@mysql01 scripts] $mysqlcmd 3306Startup MySQL CMD: localhost_3306Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 1Server version: 5.6.31-log Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
(root@localhost) [(none)] >
After reading the above about the start and stop of MYSQL through a simple script, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.