Automatic Scheduled MySQL Backup (MySQL Dump)
Is it possible to configure a UNIX/LINUX server to do a MySQL Dump for a database on an automatic schedule and then to email the dump file to me (the administrator)?
I want to be able to have my database automatically backed up every week and emailed to me for storage purposes without any action on my part.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MySQL Backup W/o Dump?
is there some free script that exports a whole database to a file similar to mysqldump but without using mysqldump? It should not be embedded too deeply into an application since I want to include it into another open-source project without having to disassemble a major other script such as phpMyAdmin.
Automatic Scheduled E-mails
I have a website that I am building in PHP that I would like to send e-mails to users every 2 days to inform of new updates. I know how to trigger the sending of e-mails if a user enters the site, and can limit this to only happening once every 2 days, but I am interested to know if it is possible to have PHP send e-mails automatically in case no one visits the site?
[Q] Automatic (i.e., Scheduled) Access To Another Web Page
I need to be able update my web site with info from a remote web site. At this other web site, the info I require is updated every 30 minutes, 24 hours per day. Life would be cool if a way existed by which I could "schedule" my code to run periodically so that my info could remain [reasonably] synchronized with the info on this other site. In the PHP docs / books I have I've been unable to find functions / services / examples that might permit me to implement this functionality. Do [php] services/classes exist that would meet this need? Do I need to invoke the services of my WEB server (apache on both ends)?
Automatic Backup Of SQL
I'ved maked a bacup sistem that saves a specific databases in a dir/ BACKUP .. on submiting a button from a form. Now I want to make it automatic ... the specific file when is written saves the date and time is saved . PHP Code:
Scheduled Mysql Queries?
How do you schedule a mysql query? Like (half pseudo-code): mysql_schedule("every five minutes"); $query = mysql_query("SELECT some integer"); $int = mysql_fetch_array($query,MYSQL_NUM); $int[0] += 10; mysql_query("INSERT $int") or something along those lines...I want my users to accumulate "taxes" every turn..even when their not playing..turns will last 5 minutes.
Table Dump With MySQL
I have recently moved from a host that provided only 1 mySQL db, to a host that allows multiple db's. How do I dump a table, or tables from the single db...into a new db(s)? I've used this before (to dump the entire db): mysqldump -h mysite.com -q mysite_dbname > db_dump.sql -pmysitepassword but I want to extract specific table(s) from the origian db and move them into newly created db's of their own on the new server.
MySql Dump On A Click
I am developing a system, in which user or power user is allowed to take the database backup, is there ne procedure, in which, on just click,,, the dump of mysql is created for backup.
MySQL Dump To Excel
I get an error on the actual dump. It does dump the file, so I know I am connecting and downloading. But, it puts all records in one line of text in the browser, and does not give me the prompt to download. Code:
Mysql Dump Results In Blankfile
I am trying to get my script working to back up a mysql database. Everything works fine only the output results in a blank file. Code:
Mysql Dump Fie Into Php Search Page
I have a dump file out of mysql that I want to use to create a search page from for my site. I only want to search the company name the position or the country at the moment. So depending on what is searched for in either of those three I want o return a result on a page in a table type format. The sql file is attached as sql.txt
PHP Script To Create MySQL DB From A Dump FIle
I just need to write a script that will read a dump file and just create the tables, ect. as specified from it. If anyone has a link or some simple code for this that would be great. Didn't think about this till i had done it, but i have the mysql create commands over multiple lines, so I can't just use: while (list($lineNum, $line) = each($dumpFile)) { mysql_query($line);}
Mysql Backup Via Php?
I am wanting to automatically do dump of a mysql database nightly using cron and some kind of script that will email the whole db structure to me (as an attachment or as plain text in my email) - including the data in the db. So, if the db was ever lost, I could go to my email, find the dump and copy and paste it into the mysql db again. Does anyone know how to do this in PHP or of a premade (and free) script out there, preferably written in PHP?
MySQL Backup
I've got a feeling that I may have asked this before but I can't find the answer if there was one offered so apologies for that... I've written a little content management system and I want to give the user the ability to back up their database. I've looked at the relevant pages in PHPMyAdmin but I'm not any closer to an answer. I just want something very simple where they click on a link and it displays a complete dump of the tables and the inserts for them to copy and paste into a .txt file.
Mysql Backup Help Please
I hope this question isn't too far off topic....I'm almost at my wits end trying to figure this out. I have a Mysql database and I wish to automate the backup of the database because I don't wish to rely on the web host doing so. I am using the "dbsender.php" script, which is written for this exact purpose (available at hotscripts.com). If I execute the script via my browser, the database is emailed to me in a 'gzip' format, which is perfect.....the script works just great. However, when I set a cron job to automate this task, I get an empty '.gz' file attached to the email instead of a ".gz" file containing my database. Seeing as the scipt works properly when executed via the browser, the script is fine. The cron job does it's task on time, and the empty .gz attachment even has the correct name to it so I'm sure the command path is correct.....but the attached .gz file is empty. What on earth could be wrong? I have tried other scripts with exactly the same result. I'll past the code below in case some kind soul can shed some light on this frustrating problem. dbsender.php script below #!/usr/local/bin/php <?php // configure your database variables below: $dbhost = 'localhost' // Server address of your MySQL Server $dbuser = 'cookie_neil' // Username to access MySQL database $dbpass = 'airbourne' // Password to access MySQL database $dbname = 'cookie_shop' // Database Name // Optional Options You May Optionally Configure $use_gzip = "yes"; // Set to No if you don't want the files sent in ..gz format $remove_sql_file = "yes"; // Set this to yes if you want to remove the ..sql file after gzipping. Yes is recommended. $remove_gzip_file = "no"; // Set this to yes if you want to delete the gzip file also. I recommend leaving it to "no" // Configure the path that this script resides on your server. $savepath = "/home/cookie/domains/mydomain.co.nz/public_html/dbsender"; // Full path to this directory. Do not use trailing slash! $send_email = "yes"; // Do you want this database backup sent to your email? Fill out the next 2 lines $to = "my@email.co.nz"; // Who to send the emails to $from = "database@mydomain.co.nz"; // Who should the emails be sent from? $senddate = date("j F Y"); $subject = "MySQL Database Backup - $senddate"; // Subject in the email to be sent. $message = "Your MySQL database has been backed up and is attached to this email"; // Brief Message. $use_ftp = "no"; // Do you want this database backup uploaded to an ftp server? Fill out the next 4 lines $ftp_server = "localhost"; // FTP hostname $ftp_user_name = "ftp_username"; // FTP username $ftp_user_pass = "ftp_password"; // FTP password $ftp_path = "/"; // This is the path to upload on your ftp server! // Do not Modify below this line! It will void your warranty! $date = date("mdy-hia"); $filename = "$savepath/$dbname-$date.sql"; passthru("mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname >$filename"); if($use_gzip=="yes"){ $zipline = "tar -czf ".$dbname."-".$date."_sql.tar.gz $dbname-$date.sql"; shell_exec($zipline); } if($remove_sql_file=="yes"){ exec("rm -r -f $filename"); }
MySQL Backup
I`m using the following code to list the tables, adding a checkbox next to the tables so I can select what tables I want to back up. However after submitting the form, I`m having this error. Warning: Invalid argument supplied for foreach() in C:Serverhtdocsadminincfunctions.php on line 6228 That line is: foreach ($tables as $table)in the performExport($tables) function. I`ve stared at this for hours now and I can`t see a problem. Code:
Trying To Get A Mysql Dump From Php Script---empty File Created
I am doing this right now on my own server at home, but would like this to be portable to my host as well. I am executing the code below and it brings up the mysql dump screen for a flash and creates the file, but it is empty. The connection information is correct. Can anyone see what I am doing wrong here? include('../connections.php'); $backupFile = $mydtb . date("Y-m-d-H-i-s") . '.dump'; $command = "mysqldump --host ".$server." -u ".$user." --password=".$password." ".$mydtb." > ".$backupFile; echo $command; system($command);
PHP MySQL Website Backup
I've found tantalizing scripts that purport to do exactly what I want (daily DB, weekly website backups) However, through may lack of familiarity with perl and **nix Each one has failed. Is there a way to use a PHP script to compress the entire website (and the dB on a seperate occasion) into a tar.gz? The zlib functions seem to be for zipping individual files. I can see FTP functions in PHP that should make executing the move. Creating the file seems to be the hard part. Or is there a way to execute the **nix command line looking stuff from the middle of a PHP script? Naturally the web-host guys know less than I do about this stuff (comforting). But I can schedule cron jobs and have been successful pointing at a file (which just gives me an error).
Automating PHP / MYSQL Backup
I am using php exec to run mysqldump and take a backup of my database, it runs just fine, but someone mentioned that I could get CRON (or something) to automate the running of my backup.php script. My script is called backup.php3 and is located in the ../../web/database directory. My site is hosted by a ISP, I can run perl, php, mysql, etc but I have absolutely no idea how to set up a CRON script to call a PHP script (I don't know what a cron script is come to that!? All I need is something (simple and easy!) to call and run the backup.php3 script, the php will do the rest!
MySQL Database Backup
I'm looking at using PHP and MySQL for a particular website application. However, I was a bit concerned that if a PHP script went wrong then it would be possible to accidentally delete or overwrite large chunks of the data in the database which presumably would then be lost. What is the usual procedure for these situations?. Is it possible to back up a database somehow so that data from a previous time can be retrieved?.
Backup MySQL Database
How does one go about using cron jobs to create a MySQL database dump each evening? I have cPanel with my hosting and when i go to cron jobs i have a 'Command to run:
Mysql Backup Connection In PHP
I notice with PHP if a connection cannot be established to a mysql server with mysql_connect() PHP will timeout and never try the backup server. In this example: $db = mysql_connect('db1.local.net', 'username', 'password'); if (!$db) { $db = mysql_connect('db2.local.net', 'username', 'password'); } This works great and connects to the 2nd database if the 1st one rejects the connection completely; however, if the 1st db is under high load and doesn't respond for 10+ seconds it never jumps to the 2nd one. Curious if there's a better way to accomplish this. If the 1st db doesn't respond in 1 second max I'd like to hop to the 2nd one.
MySQL, Backup A Table In PHP
Assuming the table MYTABLE, i want to run a script to backup the table. But there does not seem to be a straight forward function in MySQL to achieve it, Something like COPY TABLE MYTABLE, bkpMYTABLE; What would be the easiest way to do that using php? I know that i can create a table bkpMYTABLE and INSERT the data from MYTABLE to bkpMYTABLE but the problem is that i will be using the script to run updates so i will not always know the structure of the data that the user is copying, (because the script(s) will be precisely used to update the structure of the table). Maybe there is a function to retrieve the current structure and then copy the data? Also is there a way of testing if a table exists? and to test if a field within that table exists?
MYSQL Backup & Restore Using PHP ?
I'm looking for a script that will allow users/admins to have a one click backup solution for a MYSQL Database.. 'BACK DATABASE' button, click and its done... The a restore option, that shows all current backups, and restores the selected one with one click...
Problem With MySQL Backup Script
I am having problems with the following script: <BLOCKQUOTE> <font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> <? $db_user = "extremeforums"; $db_password = "password"; $db_host = "localhost"; $db_name = "extremeforums"; $backup_dir = "/www/extremeforums/backup"; $date = date("Y_m_d"); $command = `mysqldump -u$db_user -p$db_password $db_name | gzip > $backup_dir/$db_name$date.gz`; if (exec($command) == 0) { echo "Backup Successfull!"; }else { echo "Backup Failed!"; } ?> It will successfully create the archive but it doesnt contain anything. Its total size is like 20 kb. The funny this is the command will work from telnet but when fed thru this script it just chokes.
Need To Restore Phpmyadmin Mysql Backup
I have a 650 meg SQL file (!) that I need to dump back into one of our databases. However when I try to run it as a file phpmyadmin just says "Document contains data" which I guess it because the document contains too much data. Any suggestions on how to get around this? I really need to get the DB back up and running - our server got hacked.
Restoring A Mysql Backup From File
I have a .sql backup of my entire database, and I want to have a php page that will restore that file to a certain database, the query I am using is this: mysql_select_db("test_forum"); $tableName = 'test_forum'; $backupFile = 'test_forum.sql'; $query = "LOAD DATA LOCAL INFILE '$backupFile' INTO TABLE $tableName"; $result = mysql_query($query) or die("Failed: ".mysql_error()); I can see the problem in this code too, its right here: INTO TABLE $tableName I don't want to restore into a table, I want to restore the entire database. Is there something I'm missing, or is this not possible?
Restore MySQL Database Backup File Through PHP?
I wrote a PHP script to backup my complete database and send it through email. When I import the file through PHPMyAdmin, everything works. However, when I try to restore the database through PHP (I found similar code on several sites), it doesn't do anything: $restore = "mysqlimport -u $dbuser -p $dbpass $dbname $location"; $importFile = system($restore, $return); This is what $restore contains: mysqlimport -u user12345 -p pass12345 database12345 tempdata/backuprestore/mp_database_15-09-2007.sql I also tried shell_exec instead of system aswell, but this didn't work either. Does anyone know how I can do this with PHP? I need this for my admin panel. PS: mysqlimport is used to import data into a already existing database, right? Since that's what I need.
Php Program To Backup/restore Mysql Database?
I'm looking for a PHP program to backup and restore a mysql database. I'm using Godaddy to host a forum. Their mysql control panel will only restore a database of two megabytes or less. My database is over 13 megabytes in size.
Easiest Way To Backup Your MySQL Database On Multiple FTP Servers For FREE!
Here's the only tool you need to do scheduled backups of your MySQL database on multiple FTP servers! It PHP based so there's no lengthy installation process involved. Extract the file on any directory of your choice, edit the configuration file and you're good to go! And best of all.... IT"S FREE!!! Visit: http://sourceforge.net/projects/myphpdumptool/
Select MySQL W/o Automatic Vars
I'm used to working on PHP4. This project is on PHP5, and they have the ability to automatically create variables from request parameters turned off. So now it looks like I'm uable to select/print data from an MySQL database. I know this is probably very simple, but can someone point me in the right direction? Thanks! Here's my code I'm using: PHP Code:
PHP And MySQL: How To Properly Call A Stored Procedure With Output Parameters From PHP - Mysql, Mysqli, Or PDO
I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a hell of a time with it... The following comes from phpinfo(): PHP Version: 5.1.2 mysql Client API version: 5.0.18 mysqli Client API version: 5.0.18 PDO Driver for MySQL, client library version: 5.0.18 MySQL version, from running SELECT version(); = 5.0.18 Here's the procedure I've created in MySQL: CREATE PROCEDURE testproc(OUT p_testvar varchar(50)) BEGIN SET p_testvar = 'HELLO WORLD!' END [color=blue] >From the MySQL Command Line, I can do the following:[/color] mysql> call testproc(@a); Query OK, 0 rows affected (0.00 sec) mysql> select @a; +--------------+ | @a | +--------------+ | HELLO WORLD! | +--------------+ 1 row in set (0.00 sec)
MySQL Error - Supplied Argument Is Not A Valid MySQL-Link Resource
I am getting the error Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/server7/public_html/71/arranholloway/database4.php on line 7 I tested my code on local computer and there were no problems, the error message only appeared when I loaded it onto my web hosters server. I'm new to PHP so its probably something simple but any help would be appreciated.
Connection With MySQL. Navicat - CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST
I am new in PHP & MYSQL. I installed PHP & MYSQL properly. To easy operate for MYSQL I installed Navicat and it installed properly. But when I am going to test the connection between MYSQL & Navicate the error message showing CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST (10022) it should mention that my connection name = localhost, Ip = localhost,port = 3306 , user name = root in Navicat.
PHP Saying Error In Mysql Syntax, But Written My Mysql Query Browser!
I have a basic db that I access with MySQL query browser. Everything seems fine to me but I am using this db as part of a php shopping basket and when I try to add an item I get: Notice: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '>function.extract]: First argument should be an array in functions.inc.php on line 31 Notice: Undefined variable: price in functions.inc.php on line 36 Notice: Undefined variable: price in functions.inc.php on line 39 Notice: Undefined variable: total in unctions.inc.php on line 39 I'm assuming the last three are caused by this problem as price should be passed to the cart, and total is worked out using it. However although I know mySQL code it was the MySQL query browser that actually generated the code and I cannot see a way to view or debug the code. The db has one table in it which is made up of id, name, subname, desc, and price. The code in the php file that is being referred to is:
Scheduled Events
possible to get php to execute a script at certain times a day ? or is the only way to have a list of set times in a db, and when each user comes to my site see if it has been done or not ? and do, or dont do accordingly?
Scheduled Scripts
Can anyone tell me if there is a way of having a PHP script run at a scheduled time each day? Our ISP's server is running under Linux and I was hoping to use something called CRON. However my ISP has told me this is not possible, and I will need to write the script in PERL.
Scheduled E-mails
I would like to create a "send out scheduled e-mails" function in my PHP application. I guess it would be hard to program this function using PHP. What ways can I implement this?
PHP/MySQL: Using PHP To Probe MySQL Db And Send An Email Automatically
Let's say you have a login feature on your site... and a user forgets their password which is stored along side their email address in a MySQL database. Is it possible to use PHP to automatically send the password to that email address upon request? If so, please provide a detailed solution. If not, can Java be used in some way to accomplish this?
Script To Run At A Scheduled Time
I would like to know if there is a way I can get a PHP script to run at a scheduled time? Is there a command or do I have to do something else?
OT (possibly): Scheduled Actions
I've got a dedicated server running Windows 2003, IIS, MySQL and PHP. I'm working on a web site which needs to pick data up on a semi-regular basis from a CSV file which will exist in a directory accessible to this server. The data will be put there by another server. I need to pick up this data and insert it into a MySQL table; I have three options in theory - do it on a strict schedule, do it on request by an admin user (the easy option), or have it happen automatically if a file drops into that directory. Can PHP do this, or do I need to look at something else to do this for me? I can install/setup anything I like on this server, within reason.
Scheduled AT Job Reports 'The Account Is Currently Not Available'
I am scheduling an AT task from a php file using sudo and user 'joe' that reports correctly when using atq from the command line. However, although the script being executed by the job runs ok from the command line I get a mail message saying 'The account is currently not available' when the job is scheduled by php? It's not an 'apache' user problem as far as I can see as the task is getting scheduled as 'joe'.
--with-mysql ? Php-4.4.2 With Mysql Install In Special Directory
I'm trying to link php-4.4.2 with mysql install in special directory, like /usr/newsystem/mysql, but whatever options I try, php always gets linked to version in /usr/local/lib. I've tried several options: --with-mysql=/usr/newsystem/mysql --with-mysql-dir=/usr/newsystem/mysql --with-mysql-lib=/usr/newsystem/mysql --with-mysql-lib-dir=/usr/newsystem/mysql ....but none of them work, CLI is always build against /usr/local/lib/ libraries.
Create A Sequence In MySQL, With Mysql Variable?
This might be fairly easy to do and I think I've seen the code before, but I haven't seen many good examples of this. Of course Pear::DB probably uses this code in some of its API, probably in dealing with auto-increment indexes and prepared statements. Maybe I'm off base here, but I'm looking for something like this: (psuedo-code) Of course the seq table only needs 1 row holding id, which is updated. select id from tbl; // get result resouce and do fetch, store value in $myid set @myvar = $myid + 1; // can php send to MySQL with a query? ( never seen this ) update myseq set id=@myvar // send this statement through in a update/query // for use in PHP code $newSeqVal = $myid +1
Create A Sequence In MySQL, With Mysql Variable?
This might be fairly easy to do and I think I've seen the code before, but I haven't seen many good examples of this. Of course Pear::DB probably uses this code in some of its API, probably in dealing with auto-increment indexes and prepared statements. Maybe I'm off base here, but I'm looking for something like this: (psuedo-code) Of course the seq table only needs 1 row holding id, which is updated. select id from tbl; // get result resouce and do fetch, store value in $myid set @myvar = $myid + 1; // can php send to MySQL with a query? ( never seen this ) update myseq set id=@myvar // send this statement through in a update/query // for use in PHP code $newSeqVal = $myid +1
Copy And Paste On MySQL To MySQL Database
Would there be any issues if i literary Copy and Paste a mysql db from one server to another mysql db server? When i say "copy and paste" is just like tranferring one word doc from one pc to another pc. I tried the copy and paste already and the new server had recognize the DB i had pasted. I just want to confirm if there would be issues doing it so.. Or should i use Mysql.com Migration toolkit?
Strange Characters When Script Run By Scheduled Task
I've written a script that is run on a Windows server which gets headlines from a remote webpage, and I'm using a scheduled task to run it on a regular basis. The problem is that swedish characters (åäö) gets replaced with other characters.Example: Quote: Boverket sõger ja till ICA Maxi. v- och mp-r÷ster hotar budgetf÷rslaget. When I run the script from the web through my browser, it works fine. This only happens when I run it with a sheduled task.
|