Shell script fails to create a mysql backupHow do you change the default shell for ALL USERS to bash?How to take daily backup of database?What is the best way to use the mysql charm in Juju with dynamic database credientials?grant command syntax error near password in shell scriptHow can I get mysqldump to use the credentials from mysql_config_editor in a crontab-executed script?Terminal crashes when running lsblk -hDelete oldest file in a directory, when there are more than 7 files?Php script does not connect to MySQL (Vagrant VM)Unable to insert in table in database in mysql using phpHow do I start and stop a systemctl service inside a bash script?
When did Linux kernel become libre software?
Confusion about off peak timings of London trains
Can the poison from Kingsmen be concocted?
What is the advantage of carrying a tripod and ND-filters when you could use image stacking instead?
Smooth switching between 12 V batteries, with a toggle switch
Was the Tamarian language in "Darmok" inspired by Jack Vance's "The Asutra"?
Efficient integer floor function in C++
What is the giant octopus in the torture chamber for?
"You've got another thing coming" - translation into French
Why doesn’t a normal window produce an apparent rainbow?
What risks are there when you clear your cookies instead of logging off?
How do governments keep track of their issued currency?
Did the ending really happen in Baby Driver?
How much salt (or any other substance one can find in a kitchen) do I need to add to make water boil at 104 °C?
Does a 3rd-level Wolf Totem barbarian get advantage against enemies when an ally is within 5 feet of the enemy?
How to project 3d image in the planes xy, xz, yz?
What's the name of this light airplane?
Magento 2: PWA sample data installation error
Are "living" organ banks practical?
Should an arbiter claim draw at a K+R vs K+R endgame?
How did they achieve the Gunslinger's shining eye effect in Westworld?
Indirectly defined macros: Undefined macro with "@" does not trigger compile error
What's up with this leaf?
Why does the Schrödinger equation work so well for the hydrogen atom despite the relativistic boundary at the nucleus?
Shell script fails to create a mysql backup
How do you change the default shell for ALL USERS to bash?How to take daily backup of database?What is the best way to use the mysql charm in Juju with dynamic database credientials?grant command syntax error near password in shell scriptHow can I get mysqldump to use the credentials from mysql_config_editor in a crontab-executed script?Terminal crashes when running lsblk -hDelete oldest file in a directory, when there are more than 7 files?Php script does not connect to MySQL (Vagrant VM)Unable to insert in table in database in mysql using phpHow do I start and stop a systemctl service inside a bash script?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to create a shell script to automatically backup MySQL DB. I will later copy it to an s3 bucket.
I have created the following shell script:
#vim /home/ubuntu/backup/mysqlbackup.sh
#!/bin/bash
## Specify the name of the database that you want to backupbackup
# Database credentials
USER="user1"
PASSWORD="password"
HOST="hostname.compute.amazonaws.com"
DB_NAME="db1"
#Backup_Directory_Locations
BACKUPROOT="/home/ubuntu/backup"
TSTAMP=$(date +"%d-%b-%Y-%H-%M-%S")
S3BUCKET="s3://s3bucket"
#LOG_FILE="/home/ubuntu/backup/log/dump.log"
mysqldump -h <HOST> -u <USER> --database <DB_NAME> -p"$PASSWORD" > $BACKUPROOT/$DB_NAME-$TSTAMP.sql
Then from the command line, I run the script:
sudo bash -x ./mysqlbackup.sh
And it fails, telling me:
HOST: No such file or directory

command-line bash mysql
add a comment |
I want to create a shell script to automatically backup MySQL DB. I will later copy it to an s3 bucket.
I have created the following shell script:
#vim /home/ubuntu/backup/mysqlbackup.sh
#!/bin/bash
## Specify the name of the database that you want to backupbackup
# Database credentials
USER="user1"
PASSWORD="password"
HOST="hostname.compute.amazonaws.com"
DB_NAME="db1"
#Backup_Directory_Locations
BACKUPROOT="/home/ubuntu/backup"
TSTAMP=$(date +"%d-%b-%Y-%H-%M-%S")
S3BUCKET="s3://s3bucket"
#LOG_FILE="/home/ubuntu/backup/log/dump.log"
mysqldump -h <HOST> -u <USER> --database <DB_NAME> -p"$PASSWORD" > $BACKUPROOT/$DB_NAME-$TSTAMP.sql
Then from the command line, I run the script:
sudo bash -x ./mysqlbackup.sh
And it fails, telling me:
HOST: No such file or directory

command-line bash mysql
add a comment |
I want to create a shell script to automatically backup MySQL DB. I will later copy it to an s3 bucket.
I have created the following shell script:
#vim /home/ubuntu/backup/mysqlbackup.sh
#!/bin/bash
## Specify the name of the database that you want to backupbackup
# Database credentials
USER="user1"
PASSWORD="password"
HOST="hostname.compute.amazonaws.com"
DB_NAME="db1"
#Backup_Directory_Locations
BACKUPROOT="/home/ubuntu/backup"
TSTAMP=$(date +"%d-%b-%Y-%H-%M-%S")
S3BUCKET="s3://s3bucket"
#LOG_FILE="/home/ubuntu/backup/log/dump.log"
mysqldump -h <HOST> -u <USER> --database <DB_NAME> -p"$PASSWORD" > $BACKUPROOT/$DB_NAME-$TSTAMP.sql
Then from the command line, I run the script:
sudo bash -x ./mysqlbackup.sh
And it fails, telling me:
HOST: No such file or directory

command-line bash mysql
I want to create a shell script to automatically backup MySQL DB. I will later copy it to an s3 bucket.
I have created the following shell script:
#vim /home/ubuntu/backup/mysqlbackup.sh
#!/bin/bash
## Specify the name of the database that you want to backupbackup
# Database credentials
USER="user1"
PASSWORD="password"
HOST="hostname.compute.amazonaws.com"
DB_NAME="db1"
#Backup_Directory_Locations
BACKUPROOT="/home/ubuntu/backup"
TSTAMP=$(date +"%d-%b-%Y-%H-%M-%S")
S3BUCKET="s3://s3bucket"
#LOG_FILE="/home/ubuntu/backup/log/dump.log"
mysqldump -h <HOST> -u <USER> --database <DB_NAME> -p"$PASSWORD" > $BACKUPROOT/$DB_NAME-$TSTAMP.sql
Then from the command line, I run the script:
sudo bash -x ./mysqlbackup.sh
And it fails, telling me:
HOST: No such file or directory

command-line bash mysql
command-line bash mysql
asked May 21 at 1:24
Hooman BahreiniHooman Bahreini
1747
1747
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
<HOST>. <DB_NAME> etc, are just placeholders.
They should be replaced by actual strings or shell variable expansions "$HOST", "$DB_NAME" and so on - just as you have done with -p"$PASSWORD"
The error message is because < and > are redirection operators.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1144917%2fshell-script-fails-to-create-a-mysql-backup%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
<HOST>. <DB_NAME> etc, are just placeholders.
They should be replaced by actual strings or shell variable expansions "$HOST", "$DB_NAME" and so on - just as you have done with -p"$PASSWORD"
The error message is because < and > are redirection operators.
add a comment |
<HOST>. <DB_NAME> etc, are just placeholders.
They should be replaced by actual strings or shell variable expansions "$HOST", "$DB_NAME" and so on - just as you have done with -p"$PASSWORD"
The error message is because < and > are redirection operators.
add a comment |
<HOST>. <DB_NAME> etc, are just placeholders.
They should be replaced by actual strings or shell variable expansions "$HOST", "$DB_NAME" and so on - just as you have done with -p"$PASSWORD"
The error message is because < and > are redirection operators.
<HOST>. <DB_NAME> etc, are just placeholders.
They should be replaced by actual strings or shell variable expansions "$HOST", "$DB_NAME" and so on - just as you have done with -p"$PASSWORD"
The error message is because < and > are redirection operators.
answered May 21 at 1:28
steeldriversteeldriver
73.5k11121197
73.5k11121197
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1144917%2fshell-script-fails-to-create-a-mysql-backup%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown