The following script is a simple command used to execute remote database queries. I believe everyone can understand it. This is for some brothers who need to automatically check the database or execute certain statements every day, it is very helpful. You can copy the Code as follows with a slight modification :#! BinshHOST192.168.5.40USERabcPASS123456QUERY 'mys
The following script is a simple command used to execute remote database queries. I believe everyone can understand it. This is for some brothers who need to automatically check the database or execute certain statements every day, it is very helpful. The code can be modified as follows :#! /Bin/sh HOST = 192.168.5.40 USER = abc PASS = 123456 QUERY = 'mys
The following script is a simple command used to execute remote database queries. I believe everyone can understand it. This is for some brothers who need to automatically check the database or execute certain statements every day, it is very helpful. You only need to modify it a little.
The Code is as follows:
#! /Bin/sh
HOST = 192.168.5.40
USER = abc
Passes = 123456
QUERY = 'mysql-h $ HOST-u $ USER-p $ PASS <EOF
Use testdb;
Select * from person where;
Exit
EOF'
Echo $ QUERY
For example, if you change this script to a script used to safely delete mysql 2 process logs, the binary log of the Mysql master-slave synchronization database is usually large and it is not safe to manually delete files.
The Code is as follows:
#! /Bin/sh
Host = 192.168.5.30
User = abc
PW = 123456
MSG = 'mysql-h $ Host-u $ User-p $ PW < < font="">
Show master status;
Exit
EOF'
LOG = 'echo $ MSG | awk' {print $5 }''
Mysql-h $ Host-u $ User-p $ PW <FOE
Purge master logs to "$ LOG ";
Exit
FOE <>