<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: MySql backup script</title> <atom:link href="http://www.cyberciti.biz/tips/mysql-backup-script.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/mysql-backup-script.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Lucian Daniliuc</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-171876</link> <dc:creator>Lucian Daniliuc</dc:creator> <pubDate>Sun, 12 Jun 2011 11:10:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-171876</guid> <description>Great script! Thanks a lot!</description> <content:encoded><![CDATA[<p>Great script! Thanks a lot!</p> ]]></content:encoded> </item> <item><title>By: cyberdesigner.net</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-149707</link> <dc:creator>cyberdesigner.net</dc:creator> <pubDate>Mon, 27 Jul 2009 08:29:29 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-149707</guid> <description>@Mark:
better use
NOW=”$(date +”%d-%m-%Y-%H-%M”)”
because if you make backups on each hour you have 2009-07-27-10-00 twice a day ;-)</description> <content:encoded><![CDATA[<p>@Mark:</p><p>better use<br
/> NOW=”$(date +”%d-%m-%Y-%H-%M”)”</p><p>because if you make backups on each hour you have 2009-07-27-10-00 twice a day ;-)</p> ]]></content:encoded> </item> <item><title>By: Mark</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-148017</link> <dc:creator>Mark</dc:creator> <pubDate>Mon, 06 Apr 2009 15:52:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-148017</guid> <description>Thanks for the script, if you run this script more than once a day, i believe it overwrites itself. I changed line 75 to this so you can run it more than once a day:
NOW=&quot;$(date +&quot;%d-%m-%Y-%I-%M&quot;)&quot;</description> <content:encoded><![CDATA[<p>Thanks for the script, if you run this script more than once a day, i believe it overwrites itself. I changed line 75 to this so you can run it more than once a day:</p><p>NOW=&#8221;$(date +&#8221;%d-%m-%Y-%I-%M&#8221;)&#8221;</p> ]]></content:encoded> </item> <item><title>By: China pictures</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-145354</link> <dc:creator>China pictures</dc:creator> <pubDate>Fri, 24 Oct 2008 01:57:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-145354</guid> <description>I don&#039;t want to write the password in the script, is there a way like with postgresql (pg_pass file), but with MySQL ?</description> <content:encoded><![CDATA[<p>I don&#8217;t want to write the password in the script, is there a way like with postgresql (pg_pass file), but with MySQL ?</p> ]]></content:encoded> </item> <item><title>By: antony</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-145272</link> <dc:creator>antony</dc:creator> <pubDate>Wed, 15 Oct 2008 05:41:25 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-145272</guid> <description>i fount this one very helpful. thanks a lot</description> <content:encoded><![CDATA[<p>i fount this one very helpful. thanks a lot</p> ]]></content:encoded> </item> <item><title>By: Ravi Shankar</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-141622</link> <dc:creator>Ravi Shankar</dc:creator> <pubDate>Tue, 06 Nov 2007 07:42:58 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-141622</guid> <description>Hi Dear ,
I am glad to find this script .
Its working fine.
But I have ome another problem regarding backup.
I am dexcribing the problem below
&quot;I have to take backup of mysql table from remote machine and insert it into mylocal machine .&quot;
I have created one such script. Thats working as well.But there is still some problem regarding peformance of the script.
If some-one reexecute the xcript it reinsert the data .
which should not be done .
I am pasting the code as well .
Kindly suggest me the bugs and inhancement if there are any..
***************************************************
#!/bin/bash
PING=&quot;/bin/ping&quot;
host=&quot;192.168.1.160&quot;
$PING -c1  $host&gt;/dev/null
if [ &quot;$?&quot; != &quot;0&quot; ] ; then
echo &quot;source host unreachable&quot;
else
echo &quot;going to take backup &quot;
mysql -u ravi -h 192.168.1.160 --password=shankar test -e &#039;select * from usermst&#039; &gt; /home/ravi/reg.txt
if [ &quot;$?&quot; != &quot;0&quot; ] ; then
echo &quot;some error while taking backup so removing temprory file&quot;
rm /home/ravi/reg.txt
else
echo &quot;preparing to insert data&quot;
mysql -u root test -e &#039;load data local infile &quot;/home/ravi/reg.txt&quot; into table usermst&#039;
if [ &quot;$?&quot; != &quot;0&quot; ] ; then
echo &quot;could not insert data so removing temporary file&quot;
rm /home/ravi/reg.txt
else
echo &quot;data has been inserted&quot;
rm /home/ravi/reg.txt
echo temporary text file has been removed
fi
fi
fi
***************************************************
thanks
Ravi Shankar</description> <content:encoded><![CDATA[<p>Hi Dear ,<br
/> I am glad to find this script .<br
/> Its working fine.<br
/> But I have ome another problem regarding backup.<br
/> I am dexcribing the problem below<br
/> &#8220;I have to take backup of mysql table from remote machine and insert it into mylocal machine .&#8221;<br
/> I have created one such script. Thats working as well.But there is still some problem regarding peformance of the script.</p><p>If some-one reexecute the xcript it reinsert the data .<br
/> which should not be done .<br
/> I am pasting the code as well .<br
/> Kindly suggest me the bugs and inhancement if there are any..</p><p>***************************************************</p><p>#!/bin/bash<br
/> PING=&#8221;/bin/ping&#8221;<br
/> host=&#8221;192.168.1.160&#8243;<br
/> $PING -c1  $host&gt;/dev/null<br
/> if [ "$?" != "0" ] ; then<br
/> echo &#8220;source host unreachable&#8221;<br
/> else<br
/> echo &#8220;going to take backup &#8221;<br
/> mysql -u ravi -h 192.168.1.160 &#8211;password=shankar test -e &#8216;select * from usermst&#8217; &gt; /home/ravi/reg.txt<br
/> if [ "$?" != "0" ] ; then<br
/> echo &#8220;some error while taking backup so removing temprory file&#8221;<br
/> rm /home/ravi/reg.txt<br
/> else<br
/> echo &#8220;preparing to insert data&#8221;</p><p> mysql -u root test -e &#8216;load data local infile &#8220;/home/ravi/reg.txt&#8221; into table usermst&#8217;<br
/> if [ "$?" != "0" ] ; then<br
/> echo &#8220;could not insert data so removing temporary file&#8221;<br
/> rm /home/ravi/reg.txt<br
/> else<br
/> echo &#8220;data has been inserted&#8221;<br
/> rm /home/ravi/reg.txt<br
/> echo temporary text file has been removed<br
/> fi<br
/> fi<br
/> fi</p><p>***************************************************<br
/> thanks<br
/> Ravi Shankar</p> ]]></content:encoded> </item> <item><title>By: karo</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-141445</link> <dc:creator>karo</dc:creator> <pubDate>Sat, 20 Oct 2007 00:20:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-141445</guid> <description>What is the
# Store list of databases
DBS=&quot;&quot;
leave bank or can insert an option</description> <content:encoded><![CDATA[<p>What is the</p><p># Store list of databases<br
/> DBS=&#8221;"</p><p>leave bank or can insert an option</p> ]]></content:encoded> </item> <item><title>By: Ciprian</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-141275</link> <dc:creator>Ciprian</dc:creator> <pubDate>Thu, 04 Oct 2007 06:36:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-141275</guid> <description>Hello guys.
I am looking up how to backup a table into a specified folder/file (my own path) of my remote server.
The purpose is I want to change the db and tables CHARSET to UTF-8 automatically (this would be done by the installer script of the app I distribute).
At this point, I came into this problem:
mysql_query(&quot;SELECT * FROM config INTO OUTFILE &#039;./test.txt&#039; FIELDS TERMINATED BY &#039;,&#039;;&quot;, $conn);
I put the test.txt file into the php script directory, I CHMODed it to 777, but no luck. What am I missing?
Is there a way to actually dump the database or each table into a specified folder (backup) of a script running on my server? (eg. public_html/script/db_backup/test.txt)?</description> <content:encoded><![CDATA[<p>Hello guys.</p><p>I am looking up how to backup a table into a specified folder/file (my own path) of my remote server.<br
/> The purpose is I want to change the db and tables CHARSET to UTF-8 automatically (this would be done by the installer script of the app I distribute).<br
/> At this point, I came into this problem:<br
/> mysql_query(&#8220;SELECT * FROM config INTO OUTFILE &#8216;./test.txt&#8217; FIELDS TERMINATED BY &#8216;,&#8217;;&#8221;, $conn);<br
/> I put the test.txt file into the php script directory, I CHMODed it to 777, but no luck. What am I missing?</p><p>Is there a way to actually dump the database or each table into a specified folder (backup) of a script running on my server? (eg. public_html/script/db_backup/test.txt)?</p> ]]></content:encoded> </item> <item><title>By: vivek</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-140334</link> <dc:creator>vivek</dc:creator> <pubDate>Sat, 30 Jun 2007 14:09:19 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-140334</guid> <description>Marten,
I don&#039;t see a problem; I can browse the link.</description> <content:encoded><![CDATA[<p>Marten,</p><p>I don&#8217;t see a problem; I can browse the link.</p> ]]></content:encoded> </item> <item><title>By: Marten</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-140332</link> <dc:creator>Marten</dc:creator> <pubDate>Sat, 30 Jun 2007 10:22:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-140332</guid> <description>the link to the script is broken.</description> <content:encoded><![CDATA[<p>the link to the script is broken.</p> ]]></content:encoded> </item> <item><title>By: Najm</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-138434</link> <dc:creator>Najm</dc:creator> <pubDate>Thu, 24 May 2007 13:20:37 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-138434</guid> <description>Hi,
I really do appreciate the work but, please if you can help me to work on WinXP or from where I can find the backup script for windows operating system. Thanks in advance.</description> <content:encoded><![CDATA[<p>Hi,</p><p>I really do appreciate the work but, please if you can help me to work on WinXP or from where I can find the backup script for windows operating system. Thanks in advance.</p> ]]></content:encoded> </item> <item><title>By: Jack</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-86249</link> <dc:creator>Jack</dc:creator> <pubDate>Mon, 12 Mar 2007 20:57:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-86249</guid> <description>nixcraf ,
I tried exactly as you wrote and it did not work.
When I tried this (I have FreeBSD 6.x , mysql 4.x):
MYSQL=&quot;/usr/local/bin/mysql&quot;
MYSQLDUMP=&quot;/usr/local/bin/mysqldump&quot;
CHOWN=&quot;/usr/sbin/chown&quot;
CHMOD=&quot;/bin/chmod&quot;
GZIP=&quot;/usr/bin/gzip&quot;
Anyway, Thanks ,
It works fine in crontab now .</description> <content:encoded><![CDATA[<p>nixcraf ,<br
/> I tried exactly as you wrote and it did not work.<br
/> When I tried this (I have FreeBSD 6.x , mysql 4.x):<br
/> MYSQL=&#8221;/usr/local/bin/mysql&#8221;<br
/> MYSQLDUMP=&#8221;/usr/local/bin/mysqldump&#8221;<br
/> CHOWN=&#8221;/usr/sbin/chown&#8221;<br
/> CHMOD=&#8221;/bin/chmod&#8221;<br
/> GZIP=&#8221;/usr/bin/gzip&#8221;</p><p>Anyway, Thanks ,<br
/> It works fine in crontab now .</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-86047</link> <dc:creator>nixcraft</dc:creator> <pubDate>Mon, 12 Mar 2007 17:28:31 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-86047</guid> <description>Jack,
Setup correct PATH variable for  cronjob and it should work. Or modify script and specify bin path as per your UNIX/BSD/Linux distro i.e.
&lt;code&gt;MYSQL=&quot;/usr/bin/mysql&quot;
MYSQLDUMP=&quot;/usr/bin/mysqldump&quot;
CHOWN=&quot;/bin/chown&quot;
CHMOD=&quot;/bin/chmod&quot;
GZIP=&quot;/bin/gzip&quot;
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>Jack,</p><p>Setup correct PATH variable for  cronjob and it should work. Or modify script and specify bin path as per your UNIX/BSD/Linux distro i.e.<br
/> <code>MYSQL="/usr/bin/mysql"<br
/> MYSQLDUMP="/usr/bin/mysqldump"<br
/> CHOWN="/bin/chown"<br
/> CHMOD="/bin/chmod"<br
/> GZIP="/bin/gzip"<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: Jack</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-85921</link> <dc:creator>Jack</dc:creator> <pubDate>Mon, 12 Mar 2007 14:53:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-85921</guid> <description>when run in prompt works fine (./mysql-backup.bash)
But why it does not work in crontab ?
in /var/log/cron , the only message we have is &quot;(root) CMD (mysql_backup.bash)</description> <content:encoded><![CDATA[<p>when run in prompt works fine (./mysql-backup.bash)</p><p>But why it does not work in crontab ?<br
/> in /var/log/cron , the only message we have is &#8220;(root) CMD (mysql_backup.bash)</p> ]]></content:encoded> </item> <item><title>By: Jette</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-79137</link> <dc:creator>Jette</dc:creator> <pubDate>Sun, 25 Feb 2007 19:15:29 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-79137</guid> <description>Problem solved...
When running the script in cron, you must replace the  &#039;which&#039; commands with the actual paths to chown, chmod, mysql etc...
Tip to FreeBSD users:
Replace this line...
$CHOWN 0.0 -R $DESTT
..with...
$CHOWN -R root $DEST
This script is simple and easy to use. It works like a charm. Thanks :-)</description> <content:encoded><![CDATA[<p>Problem solved&#8230;</p><p>When running the script in cron, you must replace the  &#8216;which&#8217; commands with the actual paths to chown, chmod, mysql etc&#8230;</p><p>Tip to FreeBSD users:<br
/> Replace this line&#8230;<br
/> $CHOWN 0.0 -R $DESTT<br
/> ..with&#8230;<br
/> $CHOWN -R root $DEST</p><p>This script is simple and easy to use. It works like a charm. Thanks :-)</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-79044</link> <dc:creator>nixcraft</dc:creator> <pubDate>Sun, 25 Feb 2007 13:56:34 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-79044</guid> <description>Make sure variable MYSQL is pointing to correct mysql client</description> <content:encoded><![CDATA[<p>Make sure variable MYSQL is pointing to correct mysql client</p> ]]></content:encoded> </item> <item><title>By: Jette</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-78994</link> <dc:creator>Jette</dc:creator> <pubDate>Sun, 25 Feb 2007 10:29:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-78994</guid> <description>When running this script in cron, I get:
Line 56: -u: command not found
Line 56 is:
DBS=&quot;$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse &#039;show databases&#039;)&quot;
It works fine, when I run it by hand.
??</description> <content:encoded><![CDATA[<p>When running this script in cron, I get:</p><p>Line 56: -u: command not found</p><p>Line 56 is:<br
/> DBS=&#8221;$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse &#8216;show databases&#8217;)&#8221;</p><p>It works fine, when I run it by hand.</p><p>??</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-19062</link> <dc:creator>nixcraft</dc:creator> <pubDate>Fri, 09 Dec 2005 13:36:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-19062</guid> <description>First download file at shell prompt (login as root user)
wget http://cyberciti.biz/download/bash_scripting/backup/mysql-backup.bash
2) Edit file in vi editor
vi mysql-backup.bash
Setup three variable as follows:
MyUSER=&quot;root&quot;
MyPASS=&quot;SET-MYSQL-PASSWORD&quot;
MyHOST=&quot;napta&quot;
3) Save script and exit shell prompt
4) Setup execute permission
chmod +x mysql-backup.bash
5) Execute script
./mysql-backup.bash
6)In few mintues backup will be dumped in
/backup/mysql directory
If you have more questions feel free to reply back</description> <content:encoded><![CDATA[<p>First download file at shell prompt (login as root user)</p><p>wget <a
href="http://cyberciti.biz/download/bash_scripting/backup/mysql-backup.bash" rel="nofollow">http://cyberciti.biz/download/bash_scripting/backup/mysql-backup.bash</a></p><p>2) Edit file in vi editor<br
/> vi mysql-backup.bash</p><p>Setup three variable as follows:</p><p>MyUSER=&#8221;root&#8221;<br
/> MyPASS=&#8221;SET-MYSQL-PASSWORD&#8221;<br
/> MyHOST=&#8221;napta&#8221;</p><p>3) Save script and exit shell prompt</p><p>4) Setup execute permission<br
/> chmod +x mysql-backup.bash</p><p>5) Execute script<br
/> ./mysql-backup.bash</p><p>6)In few mintues backup will be dumped in<br
/> /backup/mysql directory</p><p>If you have more questions feel free to reply back</p> ]]></content:encoded> </item> <item><title>By: Anonymous</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-19061</link> <dc:creator>Anonymous</dc:creator> <pubDate>Fri, 09 Dec 2005 12:12:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-19061</guid> <description>i am not getting how to use that script canu plz expalin . My user name in &quot;root&quot; hostname is napta</description> <content:encoded><![CDATA[<p>i am not getting how to use that script canu plz expalin . My user name in &#8220;root&#8221; hostname is napta</p> ]]></content:encoded> </item> <item><title>By: NINjak</title><link>http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-19060</link> <dc:creator>NINjak</dc:creator> <pubDate>Sun, 23 Oct 2005 17:52:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/mysql-backup-script.html#comment-19060</guid> <description>Great mysql backup script, a big thanks for it...
I was thinking about it to write it myself but this is (almost) what i wanted.</description> <content:encoded><![CDATA[<p>Great mysql backup script, a big thanks for it&#8230;</p><p>I was thinking about it to write it myself but this is (almost) what i wanted.</p> ]]></content:encoded> </item> </channel> </rss>
