w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Run "screen -S name ./script" command on @reboot using crontab
You want to add the following options to the 'screen' commands (e.g. before -S): -d -m From the manpage: -d -m Start screen in "detached" mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts.

Categories : Linux

Crontab Linux with PHP, MySQL, and Curl
I expect that the problem is because of this line: include("connect.php"); Note that the working directory of the php script when it get's executed by crond is the file sytem root: / rather than the directory where the php script is stored. Change the path to: include(__DIR__ . '/connect.php');

Categories : PHP

How to take MySQL database backup using MySQL Workbench?
The Data Export function in MySQL Workbench allows 2 of the 3 ways. There's a checkbox Skip Table Data (no-data) on the export page which allows to either dump with or without data. Just dumping the data without meta data is not supported.

Categories : Mysql

Take MySQL backup
Try putting the full path the mysqldump program executeCmd = "/full/path/to/mysqldump -u " + dbUser + " -p" + dbPass + " " + dbName + " -r backup.sql"; I'd also be tempted to put the full path the file where the dump is to be written as well.

Categories : Java

Using VM to backup MySQL database
It's perfectly fine as long as you do one of two things: Either ensure consistency of the tables by either shutting down the database or using something like FLUSH TABLES WITH READ LOCK while doing the snapshot (you probably don't want to do this) Use a transactionally-safe storage engine such as InnoDB (the default) for all tables that are likely to change around the time of the snapshot, and rely on its ability to recover from what looks like a crashed state, i.e. the copy of a running server. Once you realise that taking a snapshot of a running VM and booting the snapshot on another machine looks just like pulling the plug on that server and rebooting it, your choice becomes relatively easy: Make sure the system can recover from pulling the plug, and it can recover from a VM snapsho

Categories : Mysql

Backup of mysql DB not being created
I was getting the WMI exception you mention trying to make a new server instance under the "Server Administration" of mysql's "Workbench Central". I had been trying "Take Parameters from Existing Database Connection" and choosing my local DB when I got the exception. In that first "Specify the Host Machine the Database Server is running on" screen, I needed to choose the first option, "localhost". This let me create a connection to my local server through which I could import data that I had exported from another database. The export was made into a flat .sql file. You might try simply exporting to a .sql file and then putting that file on a CD.

Categories : Mysql

What happens to an INSERT during a MySQL backup?
In this case the backup can be inconsistent. You can lock your tables to prevent this from happening. If you can't lock the tables you can set up a master-slave replication. The slave can be locked and gets the newest changes after the unlock.

Categories : Mysql

MySQL Backup with WHERE Condition
Yes it is possible to backup a MySQL Table with a WHERE Condition Try the below Query select * --specify column name or back up every column into back_up_table from table_name where date >= '2013-08-01'

Categories : Mysql

Mysql how to backup and restore after version 5.5
I would copy the *.MYD and *.frm files into the target database directory, and then run a REPAIR TABLE on each table (so as to rebuild the indexes). The "target database directory" is datadir/dbname where datadir is a server parameter, and dbname is your target database name. datadir is found with the SQL command SHOW VARIABLES LIKE 'datadir';.

Categories : Mysql

php mysql backup on linux using exec
If you have root access on the server try that: sudo su www-data // Ubuntu, for other systems find out the user on which apache is running /usr/bin/mysqldump -h hostname -u root -psomepassword dbname > somepath/file.sql If that works, the problem is in php. If not, you know the problem because of the error message. But as already pointed out, crontab is a better solution for this.

Categories : PHP

PHP MySQL database backup cron job
This line should be quoted with double-quotes: $command = 'mysqldump $dbname --password=$dbpass --user=$dbuser --single-transaction >'.$backupFile; like this: $command = "mysqldump $dbname --password=$dbpass --user=$dbuser --single-transaction >".$backupFile; If not, the variable substitution that sets $dbnam, $dbpass etc won't happen

Categories : PHP

Backup a SQLServer Database to MySQL
One way to get good performance would be to write a SQL Server Integration Services (SSIS) package that connects to MySQL, truncates the relevant tables, and uses dataflows to copy the data from SQL Server tables into MySQL tables. There isn't really a common backup format. You could have SQL Server write out a text file with a bunch of INSERT statements. Or you could write out plain text csv files for each table. Text conversions may become an issue. Excel is notorious for messing with your data based on what it thinks the data type should be. Using SSIS is probably going to give you the cleanest inserts. It insists on clear data typing, code pages, etc, so you may find yourself writing derived column transformations in order to clean up small differences between SQL Server and MyS

Categories : Mysql

How to take mysql database backup using whenever gem in ruby?
There may be a few things to check to make sure that this is running. Are you sure that app_production.sql contains a correct dump? Or is the file created without any content? Also try using command instead of system. I think command is a whenever command where system is ruby. every 59.minutes do command "mysqldump -u root -ppassword app_production > /path/app_production.sql" # runner "MyModel.some_method" # rake "some:great:rake:task" end UPDATE: you can also look at the backup gem for backup purposes. It has a lot of features including notifications so I suggest you look at it.

Categories : Ruby On Rails

Scheduled Cloudbees MySql Backup
You can use a command line script that backups your Databases to your S3 account quite easily, and run it as often as you like. I had exactly the same problem a while back, and wrote up this handy tutorial. It should be perfect for what you want to do.

Categories : Mysql

Taking selective backup in mysql
First make sure there is a DateTime/Timestamp column in the table with the last modification time so that you know what data you need to back up or not. MySQL doesn't store this information by default with each record so if you need it you need to create it, and with that size of a table you may want to index it. If the database you are copying to is on the same system then all you would need to do is run a single query. Something like this would work. This copies all the data from db_from.my_cool_table into db_to.my_cool_table INSERT (col1, col2, col3 ...) INTO db_to.my_cool_table SELECT col1, col2, col3 FROM db_from.my_cool_table WHERE modification_time > DATE_SUB(Now(), INTERVAL -4 DAY) You may also think of adding a Trigger that will automatically insert/update/delete every r

Categories : Mysql

Unable to restore a MYSQL backup to a new Database
This is probably caused by coding systems. My dump file is generated using redirection (">") in powershell and I encountered the same problem. The output redirection generated a file with UTF-16 Little endian. However, this can be solved by converting the dumpfile into utf-8. This can be done in emacs as: M-x set-buffer-file-coding-system Then save the file and import again. The coding system of a file can be detected using GNU "file" utility, and it also available in windows and can be found here: http://gnuwin32.sourceforge.net/packages/file.htm For future use, a better dump command is like: mysqldump <dbname> -r <filename>

Categories : Mysql

Syntax error in mysql backup script
You forgot to open a bracket "(". Try this: table_types=($($MYSQL -u $DB_USER -p$DB_PASS -e "show table status from $DB" | awk '({ if ($2 == "MyISAM" || $2 == "InnoDB") print $1,$2}'))

Categories : Mysql

How to restore Mysql Backup from dump file?
If it's a dump file that you created using mysqldump, then you can build a new database from the dump file using the source command. Just login to MySQL using mysql -p, enter the root mysql password, then type: source /path/to/mysqldumpfile

Categories : Misc

MySQL stored procedure to take database backup
I've never seen a stored procedure that can back up a database. I would recommend not trying to code one yourself, because it's deceptively difficult to get right. I've seen a number of shell scripts and PHP scripts that claim to create a database dump, but they usually fail in spectacular ways: not locking tables to ensure consistent snapshot, not handling NULL or not handling character set, not backing up procedures and triggers, etc. The standard way of backing up on a schedule is to use one of the external tools like mysqldump, mydumper, or Percona XtraBackup, and write a cron job to invoke the preferred tool.

Categories : Mysql

Backup frequently a huge MySQL database
Have you looked at writing a script that uses mysqldump to dump the contents of the DB, transfers it over to the backup DB (piping it to SSH would work), and inserts it via the command line? There are options so that mysqldump won't lock the tables and so won't degrade performance too much.

Categories : Mysql

SQL Azure automated backup fails on a DB which has been deleted - cannot remove backup task
Response from SQL Azure team: Hello, We have investigated the issue and should have a fix soon. In the meantime I would recommend creating a filter for these emails. Once the fix is rolled out you can remove the filter (I will respond back to this thread once it is). If you do not want to receive any failure emails you can opt-out permanently via the Unsubscribe link at the bottom of the email. Note, however, that this is permanent and will apply to all export failure emails: once you have opted out there is no way to opt back in later. Apologies for the inconvenience, -Stephen

Categories : SQL

Import MySQL Backup Table-Names lowercase
Try with replacing the YOUR_DATABASE_NAME with your DB name SELECT CONCAT('ALTER TABLE ',db,'.',tb,' RENAME ',db,'.',LOWER(tb),';') FROM (SELECT table_schema db,table_name tb FROM information_schema.tables WHERE table_schema in (YOUR_DATABASE_NAME) ) A;

Categories : Java

Deleting old records from a mysql table but keeping a backup
I would make it simpler. Create a daily cron which executes these two queryes with "TODAY_DATE": create table if not exists featured_deal_new like featured_deal rename table featured_deal to featured_deal_history_TODAY_DATE, featured_deal_new to featured_deal What will happen: (renaming tables is very fast). You will have a history table for each day. Feel free to combine the history tables afterwards insert into featured_deal_history... select * from featured_deal_history_TODAY_DATE Drop table featured_deal_history_TODAY_DATE This way you do not loose performance on the inserts in the main table.

Categories : Mysql

Looking for Mysql Backup/Sync suggestions (multiple servers syncing to 1)
i've read about replication and all that stuff, but I kinda wanted a ready solution But replication is a ready-solution just type a few commands and change a few configuration.

Categories : Mysql

How to take a backup of year specific records from mysql table to a file?
This should work mysqldump --databases X --tables Y --where="1 limit 1000000" OR mysql cli mysql -e "select * from myTable" -u myuser -pxxxxxxxxx mydatabase > mydumpfile.txt Reference MySQL dump by query

Categories : Mysql

How to Backup mysql db from Remote to local without mysql local installation?
Solved it!, I forget to specify the HostIP & port with the mysqldump command Changed my executeCmd parameter as following: executeCmd = PathToMySqlDumpFile+"mysqldump -h "+HOSTIP+" -P "+PORT+" -u "+USER+" -p"+PASS+" "+database+" -r "+path; along with the mysqldump file path. We only need the mysqldump file to take the backup from remote server to local. No need for mysql client installation.

Categories : Java

Strategy to maintain large table of backup catalogs per project in MySQL or PostgreSQL
In general, in PostgreSQL, table partitioning helps for certain kinds of bulk operations. I don't think those apply to you so I will mention a few other things. Partial indexes. You could boost particularly large projects by giving them their own indexes, for example. This is probably going to be at least as good as table partitioning in most workloads. Look closely at your hardware. I can't offer specifics here because you don't mention enough in terms of specifics to help there. Be willing to look into more complex solutions if you need them, like Postgres-XC if your write load grows too large. Be willing to bring in outside help if you get stuck.

Categories : Mysql

How can i take my mysql database into Master Slave configuration for data backup and separation of inserts and selects
In MySQL terminology, user insertions and updates are directed to the Master, such changes are then forwarded to the Slave (so it is the other way around). If you want a bi-directional synchronisation, you will need to consider circular replication (here is a good tutorial). The next step is clustering, but this is a bit more complex to handle.

Categories : Mysql

Backup zip and transfer to FTP Backup Server an SQL-Server Express Database every hour
depending on your locale setting you might have to adjust this for the date/time parsing rem get the last 10 chars in either dd-mm-yyyy or mm-dd-yyyy set dtm=%DATE:~-10% rem last 4 is the year set yyyy=%dtm:~-4% set mm=%dtm:~4,2% set dd=%dtm:~1,2% set tim1=%TIME:.=% set tim2=%tim1:,=% rem lets just copy everyting from this date sqlcmd -S SQLSERVER -U user -P password -i script.sql 7z a -tzip C:prd-db-backup-%yyyy%%mm%%dd%%tim2%.zip -i! C:prd-db-backup-%yyyy%%mm%%dd%*.bak echo user your-ftp-username > ftpcmd.txt echo pwd your-ftp-password >> ftpcmd.txt echo cd /ftp/dir/to/store >> ftmcmd.txt echo put C:prd-db-backup-%yyyy%%mm%%dd%%tim2%.zip >> ftpcmd.txt echo bye >> ftpcmd.txt ftp -i -s:ftpcmd.txt your-ftp-server

Categories : SQL

mysqldump.exe is creating blank mysql database backup file when mysqldump exe is invoked through java
It might just be an artefact of the way that you wrote the Question, but this doesn't look correct: "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" You've got 5 spaces between Program and Files, where there is normally only 1. That could be enough to prevent the shell from finding the executable. UPDATE I think you need to find out what is being written to stderr. The simple way would be to redirect that to a different file. (I'm not sure what syntax you use to do that in Windows command language ...)

Categories : Java

How to create a MySql Job to create a database backup and a maintenace plan?
one possible way is run the following as daily cron. mysqldump -u <db_user> -p <db_password> <db_name> -h <db_host_if_any> > /home/backups/backup_<timestamp>.sql gzip it and store it(just a mechanism to reduce size) gzip /home/backup/backup_<timestamp>.sql

Categories : Mysql

how to output a MYSQL Database Backup file without saving the file first?
Just wrap around mysqldump: <?=shell_exec("mysqldump -h $server -u $dbusername -p$dbpassword $db_name");?> Note that you should really escape the variable terms of the command with escapeshellarg(), but I ommitted it for brevity.

Categories : PHP

How can I recovery mysql data which there is no data backup and no bin-log?
If you define table type as InnoDB, you can use transactions (see the link below). You will need set AUTOCOMMIT=0, and after you can issue COMMIT or ROLLBACK at the end of query or session to submit or cancel a transaction. ROLLBACK -- will undo the changes that you have made

Categories : Mysql

php mysql get the value from drop down list print to screen
I think you want to show the POST actor is selected in the drop down list for this try, You must add actor list in form element like <form method = "post" action="actors.php" > <?php print("<select name="actor_name"> "); while($row = mysqli_fetch_array($result)) { $sel=''; if($row[0]==$_POST['actor_name']) $sel='selected="selected"'; print ("<option value=" . $row[0] . " ".$sel.">" . $row[1] . "</option>"); //$row = mysql_fetch_row($result); remove this line it has no meaning } print("</select>"); ?> ..........

Categories : PHP

What is the method for clearing the screen on mysql command line?
Solution 1 system clear Solution 2 ! clear Solution 3 /c Not possible on Windows: See this link from SuperUser: http://superuser.com/questions/196806/is-there-a-command-to-clear-the-screen-of-mysql-under-windows

Categories : Mysql

Crontab not working like it should
*/10 * * * /usr/local/bin/flexget -c you had to much * */10 means "every 10 minutes" better use crontab -e which informs you about syntax errors. Don't forget to reload cron.

Categories : Linux

Crontab and PHP script
Just to leave an answer on this for future reference for others. Please check the files included into the php file being run by the Cron have absolute paths and not just paths local to the file itself. Ie: do NOT have: include 'inc/test.php'; You would need to use for example: include '/var/www/cron/inc/test.php';

Categories : PHP

Something wrong with my crontab?
For debugging purposes replace sh with /bin/sh -vx in the crontab entry: 17 15 * * * root /bin/sh -vx /opt/app/tool/ReviewSummaryTool/runf.sh Then the trace of the executed script will be printed, so emailed to you. And add logger commands inside your runf.sh script, e.g. have it be #!/bin/sh logger -t runfjob start of runf pid $$ in $(pwd) on host $(hostname) java -Dhostname=$(hostname) -jar ReviewSummaryTool.jar -full logger -t runfjob end of runf pid $$ The logger command makes entries to the system log using syslog(3). You should find these messages under /var/log, perhaps in /var/log/messages or /var/log/syslog etc... I strongly suggest to put the full path of the ReviewSummaryTool.jar file in the java command of your runf.sh script. It is likely that your cronjob is r

Categories : Linux

Using Crontab with Python
I found the problem, I will put here the solution maybe it helps someone. I tried putting in crontab -e * * * * * /usr/bin/python /path/to/script/script.py >>/tmp/script.out 2>&1 as Rafal suggested however the output was blank. I read a lot about crontab last night and I found out that if you use a script with crontab and you write your output in a certain file you will need to modify your script and input the exact path for the file. If you don't put the full path the script will work when you run it manually. The script will still work if you run it with crontab but it won't know where to place its output. So modifying with open('output.txt', 'a') as f with with open('/path/to/file/output.txt', 'a') as f did the job for me. Thanks, Diez

Categories : Python

Crontab out of memory
This is because the script which your running needs more memory.. Try to reduce ARRAY usage from your CronTab Script. Use Object return instead of Array return Values. Search result from the Database should have Limit because of the memory issue. Increase the PHP Memory. If you can able to share the code of the logic It would be much helpful for us to provide you a suitable solution.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.