Find the answer to your Linux question:
Page 4 of 4 FirstFirst 1 2 3 4
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.
  1. #31
    Just Joined!
    Join Date
    Aug 2012
    Posts
    54

    Quote Originally Posted by msohail View Post
    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 hostname/IP address in the script ?
    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?
    I am not good at coding. I dont wanna mess up anything.

    PS: the folder is writable for sure.

  2. #32
    Just Joined! msohail's Avatar
    Join Date
    Nov 2011
    Posts
    47
    Quote Originally Posted by Website View Post
    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?
    I am not good at coding. I dont wanna mess up anything.

    PS: the folder is writable for sure.

    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

  3. #33
    Just 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

  4. $spacer_open
    $spacer_close
  5. #34
    Just Joined! msohail's Avatar
    Join Date
    Nov 2011
    Posts
    47
    Ok so you only require hostname to be added in the script.

    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 the necessary changes in the script and In Sha Allah it should work out fine.

    Make sure the script has executable permissions.

    Jazak Allah
    Sohail

  6. #35
    Just 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

  7. #36
    Just Joined! msohail's Avatar
    Join Date
    Nov 2011
    Posts
    47
    Quote Originally Posted by Website View Post
    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
    Thats because you copied/edited it incorrectly

    i=`mysql -uDBUSER -pPASS -hHOSTNAME
    -e "show databases;" | awk '{print $1}' | wc -l`
    it should be in a single line as shown in my script like this

    i=`mysql -uDBUSER -pPASS -hHOSTNAME -e "show databases;" | awk '{print $1}' | wc -l`
    Incorrect

    db=`mysql -uDBUSER -pPASS -hHOSTNAME
    -e "show databases;" | awk '{print $1}' | sed -n "$count"p`
    Correct

    db=`mysql -uDBUSER -pPASS -hHOSTNAME -e "show databases;" | awk '{print $1}' | sed -n "$count"p`
    Incorrect

    mysqldump -uDBUSER -pPASS -hHOSTNAME
    $db > /nasdfgfs/c0asdsdg4/hasdg05/mnwr3w2t/136232324r243w2ef95/domains/backups/$db.sql
    Correct
    mysqldump -uDBUSER -pPASS -hHOSTNAME $db > /nasdfgfs/c0asdsdg4/hasdg05/mnwr3w2t/136232324r243w2ef95/domains/backups/$db.sql

  8. #37
    Just Joined!
    Join Date
    Aug 2012
    Posts
    54
    Works perfectly. You da man! Thank you very much!

  9. #38
    Just Joined! msohail's Avatar
    Join Date
    Nov 2011
    Posts
    47
    Quote Originally Posted by Website View Post
    Works perfectly. You da man! Thank you very much!

    Anytime.

    Jazak Allah
    Sohail

  10. #39
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    910
    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.

  11. #40
    Just Joined! msohail's Avatar
    Join Date
    Nov 2011
    Posts
    47
    Quote Originally Posted by mizzle View Post
    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.

    You are welcome to use the script.

    Jazak Allah
    Sohail

Page 4 of 4 FirstFirst 1 2 3 4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •