Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 11-03-2011, 05:31 PM
Website's Avatar
Website Website is offline
Contributing Member
 
Join Date: 11-15-10
Posts: 328
iTrader: 0 / 0%
Exclamation File of the full DB backup

I set this code as a cron job

Code:
mysqldump --opt -Q -u USERNAME --password=PASSWORD --all-databases | gzip > /home/site/public_html/folder/folder2/once_a_day_all_databases.gz
and this creates a file in the folder but in that file there is only one file which doesnt have any format. So when i want to import this file which should have 3 dabatases in it, how am i gonna import it?

Should i convert the format to sql and dump it all into one db?
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 11-03-2011, 11:55 PM
cbsmth's Avatar
cbsmth cbsmth is offline
v7n Mentor
 
Join Date: 08-17-10
Location: Mexico
Posts: 175
iTrader: 0 / 0%
The --all-databases flag makes mysqldump do just that; output all database information at once, meaning it all ends up in one file. If you want them separated, you had better create a script that runs mysqldump for each database individually. The output from mysqldump is plaintext, so purely technically you won't need to do anything with the extracted file. If you want to load that data back into your installed database, all you need to do is:
Code:
mysql -u USERNAME -p PASSWORD < your-backup-file
If you check the file in a text editor, you should see commands like CREATE DATABASE /*!32312 IF NOT EXISTS*/ `database_name`, as well as DROP TABLE IF EXISTS `table_name`.

Thus, if the database does not already exist it will be created, and if the tables already exist, they will be cleared out before the backed up data is inserted.

Last edited by cbsmth; 11-03-2011 at 11:55 PM. Reason: Typo
 
Reply With Quote
  #3  
Old 11-04-2011, 12:06 AM
Website's Avatar
Website Website is offline
Contributing Member
 
Join Date: 11-15-10
Posts: 328
iTrader: 0 / 0%
So i dont have to change the format of the file. I can just keep it as no format. But i use shared server. So i where am i gonna run this command at?
mysql -u USERNAME -p PASSWORD < your-backup-file
 
Reply With Quote
  #4  
Old 11-04-2011, 01:07 AM
cbsmth's Avatar
cbsmth cbsmth is offline
v7n Mentor
 
Join Date: 08-17-10
Location: Mexico
Posts: 175
iTrader: 0 / 0%
If you're using software such as phpMyAdmin, there should an option to upload a file as input.

If for any reason the interface doesn't take files without extensions as valid input, all you need to do is to rename the file to filename.sql.
 
Reply With Quote
  #5  
Old 11-06-2011, 07:29 PM
Website's Avatar
Website Website is offline
Contributing Member
 
Join Date: 11-15-10
Posts: 328
iTrader: 0 / 0%
The only place to upload a file is the one to import the sql into the db and that one doesnt accept any format other than compressed sql to be upload. So can you please explain mroe about how to import all the dbs at once?
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[WTS] Unique Webhosting Template For Sale , 10 Full Pages , Full Coding Options. TemplateSpin Templates and Themes 0 06-17-2011 06:32 AM
How to Restore/Extract Full VPS backup FirstHosting09 Web Hosting Forum 2 04-28-2011 12:16 AM
Cpanel full backup not working or stopped. My site have 9Gb Disk used basketmen Web Hosting Forum 3 09-13-2010 05:43 PM
Selling Madhackerz.net Full Database - Admin Access+Forum Backup+Sql Database ReardoN Content 0 03-20-2009 10:25 PM
cPanel Full Backup Script Zap Coding Forum 3 11-17-2006 11:40 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:52 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC