NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page MySQL: Automatically download tables

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 12-18-2006, 02:45 PM THREAD STARTER               #1 (permalink)
DomainersUniversity.com
 
Gene's Avatar
Join Date: Feb 2005
Location: Oswego, NY
Posts: 4,735
Gene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond repute
 


Member of the Month
April 2005
Ethan Allen Fund Cancer Survivorship Baby Health Cystic Fibrosis Marrow Donor Program Parkinson's Disease Child Abuse Save a Life Animal Rescue Save a Life Save a Life Animal Rescue

MySQL: Automatically download tables


I have a MySQL database containing many tables. Two of those tables need to be downloaded on a daily basis at 9am. How can I go about automating this process? I simply need to download the two tables in CSV format to a directory on the server. Does this require a 'cron job'? Or is there a procedure that is stored in the database somehow? Thanks in advance for any advice!
__________________
.
.

Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com
-----------------------------------------------------------------------------------------------
Gene is offline  
Old 12-18-2006, 02:49 PM   #2 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



Looking for a server based solution or a paid desktop solution?

A quick google search shows http://www.swordsky.com/

A server-based one is http://www.dagondesign.com/articles/...backup-script/

I'm sure someone can modify it to fit your needs.

-Steve
stscac is offline  
Old 12-18-2006, 03:05 PM THREAD STARTER               #3 (permalink)
DomainersUniversity.com
 
Gene's Avatar
Join Date: Feb 2005
Location: Oswego, NY
Posts: 4,735
Gene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond repute
 


Member of the Month
April 2005
Ethan Allen Fund Cancer Survivorship Baby Health Cystic Fibrosis Marrow Donor Program Parkinson's Disease Child Abuse Save a Life Animal Rescue Save a Life Save a Life Animal Rescue
Thanks Steve, Server-based is likely what I need, but I don't know enough about this to know what to look for. Is specialized software really necessary? I thought a simple command line somewhere would achieve the goal of downloading the CSV files.
__________________
.
.

Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com
-----------------------------------------------------------------------------------------------
Gene is offline  
Old 12-18-2006, 03:47 PM   #4 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



Originally Posted by Gene
Thanks Steve, Server-based is likely what I need, but I don't know enough about this to know what to look for. Is specialized software really necessary? I thought a simple command line somewhere would achieve the goal of downloading the CSV files.
Its a mixture of a crontab, a mysql query to extract the database, and then use php (or language of choice) to put it on the server.

I'll see what I can come up with.

Edit: Looks like this might be what you're looking for. With a little modification, it can be added to the server.
????: NamePros.com http://www.namepros.com/programming/270700-mysql-automatically-download-tables.html



-Steve
Last edited by stscac; 12-18-2006 at 03:54 PM.
stscac is offline  
Old 12-18-2006, 04:04 PM THREAD STARTER               #5 (permalink)
DomainersUniversity.com
 
Gene's Avatar
Join Date: Feb 2005
Location: Oswego, NY
Posts: 4,735
Gene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond repute
 


Member of the Month
April 2005
Ethan Allen Fund Cancer Survivorship Baby Health Cystic Fibrosis Marrow Donor Program Parkinson's Disease Child Abuse Save a Life Animal Rescue Save a Life Save a Life Animal Rescue
Thanks for finding that, but I don't think it will do what I need. I need to download two of the 'tables' that reside in one of my databases, and save these two tables as a CSV file to a folder on the server on a daily basis. No other database files should be included. Just two CSV files. No backup rotation. The same files should be overwritten every day.
__________________
.
.

Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com
-----------------------------------------------------------------------------------------------
Gene is offline  
Old 12-18-2006, 04:21 PM   #6 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of
 



Originally Posted by Gene
Thanks for finding that, but I don't think it will do what I need. I need to download two of the 'tables' that reside in one of my databases, and save these two tables as a CSV file to a folder on the server on a daily basis. No other database files should be included. Just two CSV files. No backup rotation. The same files should be overwritten every day.
If you can't find your fit, PM me and I can try to come up with a custom solution.
????: NamePros.com http://www.namepros.com/showthread.php?t=270700

-Steve
stscac is offline  
Old 12-19-2006, 03:29 AM   #7 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,552
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Originally Posted by Gene
I have a MySQL database containing many tables. Two of those tables need to be downloaded on a daily basis at 9am. How can I go about automating this process? I simply need to download the two tables in CSV format to a directory on the server. Does this require a 'cron job'? Or is there a procedure that is stored in the database somehow? Thanks in advance for any advice!
For bulk import/export in mySQL you have LOAD DATA INFILE (import) and SELECT INTO (export).
????: NamePros.com http://www.namepros.com/showthread.php?t=270700

Step 1: prepare your SQL statement with the fields you want exported.
Example:
Code:
USE your_database; # select DB

SELECT field1, field2 INTO OUTFILE '/destination/result.txt'
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  FROM your_table;
Step 2:
When you are OK with the SQL put the code into a file and save it somewhere on your server

Step 3:
Test the script from the command line (login via telnet/SSH):

/usr/local/mysql -uroot -ppassword < /scripts/mysqlcsv

In this example I assume your DB user name is root and password is password (highlighed).
I also assume that the file containing the SQL statement is saved as /scripts/mysqlcsv. The command above will instruct mySQL to process the instructions in the file.
Please note that the mySQL path may differ on your server. Use the following shell command to determine the mysql path if needed:

whereis mysql

Step 4:
When your script is working from command line as per above then you just add a cronjob entry with that command line. And the job is now automated.

Shoot me a PM if you require further assistance.
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:33 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger