Results 31 to 40 of 40
Originally Posted by msohail
Seems like the hosting providers enabled binding address feature in mysql.
can you do the same editing in the script I gave you, that is, adding ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-13-2013 #31Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
Can you please make the changes in the script and send the entire script here so i can copy and paste after changing the credidentials?can you do the same editing in the script I gave you, that is, adding hostname/IP address in the script ?
I am not good at coding. I dont wanna mess up anything.
PS: the folder is writable for sure.
- 02-13-2013 #32
Sure I will, but first send me the script which you executed half hour ago which gave you the entire list of databases.
Database
information_schema
db244952345_affiliatemarketingprogramguide
db244952345_affiliatepartnershipguide
db244952345_affiliateprogramjournal
db244952345_affiliatesolutionguide
db244952345_brandadvocacycentral
db244952345_brandadvocacyguide
db244952345_churnratereductionguide
db244952345_customeradvocacycentral
db244952345_customeradvocacyguide
db244952345_customerloyaltycentral
db244952345_franchisemarketingcentral
db244952345_franchisesuccessguide
db244952345_gamificationcentral
db244952345_localpromotionsguide
db244952345_loyaltyjournal
db244952345_loyaltymanagerguide
db244952345_loyaltyprogramguide
db244952345_loyaltyprogramvendors
db244952345_membershipretentionideas
db244952345_onlineaffiliateprogramguide
db244952345_opengraphintegrationguide
db244952345_partnershipmanagerguide
db244952345_partnershipprogramguide
db244952345_promotionpartnerscentral
db244952345_promotionpartnersguide
db244952345_referraljournal
db244952345_retailbrandguide
db244952345_retailfranchisecentral
db244952345_retentionguide
db244952345_saasretentionguide
db244952345_socialadvocacyguide
db244952345_socialgraphpromotionsguide
db244952345_socialloyaltyguide
db244952345_socialreferralcentral
db244952345_upsellguide
db244952345_upsellingtechniques
- 02-13-2013 #33Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
I wrote
mysql -uDBUSERNAME -pPASSWORD -hHOSTNAME -e "show databases;" | awk '{print $1}'
to SSH to get that list
and I was trying to use this script to backup the DBs
Code:count=2 i=`mysql -uDBUSERNAME -pPASSWORD -e "show databases;" | awk '{print $1}' | wc -l` while [ $count -le $i ] do db=`mysql -uDBUSERNAME -pPASSWORD -e "show databases;" | awk '{print $1}' | sed -n "$count"p` if [ "$db" == "information_schema" ] || [ "$db" == "performance_schema" ] || [ "$db" == "mysql" ]; then ((++count)) echo "Skipping" >> /dev/null else mysqldump -uDBUSERNAME -pPASSWORD $db > /nfs/c0434/hf0541/mnt/1162744/domains/site.com/html/backups/$db.sql ((++count)) fi done
- 02-13-2013 #34
Ok so you only require hostname to be added in the script.
Make the necessary changes in the script and In Sha Allah it should work out fine.Code:count=2 i=`mysql -uDBUSERNAME -pPASSWORD -hHOSTNAME -e "show databases;" | awk '{print $1}' | wc -l` while [ $count -le $i ] do db=`mysql -uDBUSERNAME -pPASSWORD -hHOSTNAME -e "show databases;" | awk '{print $1}' | sed -n "$count"p` if [ "$db" == "information_schema" ] || [ "$db" == "performance_schema" ] || [ "$db" == "mysql" ]; then ((++count)) echo "Skipping" >> /dev/null else mysqldump -uDBUSERNAME -pPASSWORD -hHOSTNAME $db > /DESTINATION_FOLDER/$db.sql ((++count)) fi done
Make sure the script has executable permissions.
Jazak Allah
Sohail
- 02-13-2013 #35Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
I get this error now
line 4: -e: command not found
Code:count=2 i=`mysql -uDBUSER -pPASS -hHOSTNAME -e "show databases;" | awk '{print $1}' | wc -l` while [ $count -le $i ] do db=`mysql -uDBUSER -pPASS -hHOSTNAME -e "show databases;" | awk '{print $1}' | sed -n "$count"p` if [ "$db" == "information_schema" ] || [ "$db" == "performance_schema" ] || [ "$db" == "mysql" ]; then ((++count)) echo "Skipping" >> /dev/null else mysqldump -uDBUSER -pPASS -hHOSTNAME $db > /nasdfgfs/c0asdsdg4/hasdg05/mnwr3w2t/136232324r243w2ef95/domains/backups/$db.sql ((++count)) fi done
- 02-13-2013 #36
Thats because you copied/edited it incorrectly
it should be in a single line as shown in my script like thisi=`mysql -uDBUSER -pPASS -hHOSTNAME
-e "show databases;" | awk '{print $1}' | wc -l`
Incorrecti=`mysql -uDBUSER -pPASS -hHOSTNAME -e "show databases;" | awk '{print $1}' | wc -l`
Correctdb=`mysql -uDBUSER -pPASS -hHOSTNAME
-e "show databases;" | awk '{print $1}' | sed -n "$count"p`
Incorrectdb=`mysql -uDBUSER -pPASS -hHOSTNAME -e "show databases;" | awk '{print $1}' | sed -n "$count"p`
Correctmysqldump -uDBUSER -pPASS -hHOSTNAME
$db > /nasdfgfs/c0asdsdg4/hasdg05/mnwr3w2t/136232324r243w2ef95/domains/backups/$db.sql
mysqldump -uDBUSER -pPASS -hHOSTNAME $db > /nasdfgfs/c0asdsdg4/hasdg05/mnwr3w2t/136232324r243w2ef95/domains/backups/$db.sql
- 02-13-2013 #37Just Joined!
- Join Date
- Aug 2012
- Posts
- 54
Works perfectly. You da man! Thank you very much!
- 02-13-2013 #38
- 02-13-2013 #39Linux Enthusiast
- Join Date
- Apr 2012
- Location
- Virginia, USA
- Posts
- 561
Oh, that is good code to make the script scale

My script was just a simple one for a small amount of DBs. If you don't mind, I will use some of your code to make my script more scaleable for others.
- 02-13-2013 #40



Reply With Quote
