mysqldump

mysqldump with partitioned table

Hi, I have a large MyiSam table and I recently partitioned it. I backup the db every day usng mysqldump but rather than bakcup the entire large table, I'd like to just backup certain partition(s). Is there any way that I can specify which partitions to dump using mysqldump? ...

MySQL lost after upgrading to Snow Leopard

I made a silly mistake of upgrading Leopard a tad too soon. I thought I dumped my mysql files but the last backup is about a month old. Now I upgraded the computer to Snow Leopard, and trying to run the old mysql server wasn't happening. So I read you must reinstall mysql with a newer version which I did and it ran just fine and starts...

How to I use mysqldump to export only the CREATE TABLE commands?

I'm try to use mysqldump to export only the DB schema -- no data, no additional SQL comments, just the CREATE TABLE commands. Here's what I've got so far: mysqldump -h localhost -u root -p --no-data --compact some_db It almost achieves what I want, but I'd like to eliminate the "character set" lines (those like the first 3 lines in t...

I exported via mysqldump to a file. How do I find out the file encoding of the file ?

Given a text file in ubuntu (or debian unix in general), how do I find out the file encoding of the file ? Can I run od or hexdump on it to fingerprint its encoding ? What should I be looking out for ? ...

I'm looking for an english language word list

Does anyone know where I could locate an english language word list in the form of a SQL dump? I found a word list online but it's a large plain text file; the words are delimited by a new line character. I tried writing a PHP script to loop through the words and insert them in to the database but quickly ran in to memory issues just re...

How can I get rid of these comments in a MySQL dump?

I'm trying to create a simple structure only dump of my database. Using mysqldump gives me a result like: /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!...

mysqldump table names prefix

I have two mysql databases that have almost the same structure and representing the data of the same web app but one of them represents the current version and second one was made long time ago. How can I create the database with both dumps inside but with old_ prefix for tables from the first and new_ prefix for tables from the second ...

PHP/passthru/mysqldump seems to timeout

I've got a PHP script that I call to run MySQL database backups to .sql files, TAR/GZip them and e-mail them to me. One of the database is hosted by a different provider than the one providing the web server. Everything is hosted on Linux/Unix. When I run this command: $results = exec("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname...

What causes subprocess.call to output blank file when attempting db export with mysqldump?

I am having some problems using subprocess.call to export a database using mysqldump. I'm using Python 3.1 installed on Windows 7. from time import gmtime, strftime import subprocess DumpDir = "c:/apps/sqlbackup/"; DumpFile = "mysqldump-" + strftime("%Y-%m-%d-%H-%M-%S", gmtime()) + ".sql"; params = [r"mysqldump --user root --password=...

Migrating server, don't wanna lose MySQL data. Is Master-Master setup viable?

I am moving to a new server and thinking about how to keep my 2 MySQL server data consistent is causing me to lose both sleep and hair. I was thinking about using a Master-Master setup to ensure that I lose nothing in the process. How viable is that. Any potential gotchas? ...

Mysqldump question

I am trying to dump a large database using mysqldump command. I would like to avoid 'use database' command in the generated sql file. This is because I want to create the same database with a different name. Since the sql file size is large I am unable to open the sql file and edit it. I tried --no-create-db but still I am getting use c...

Mysqldump create empty sql file? [php & mysql on Windows]

Hi all, I tried to dump a database: <?php $dbhost = "localhost"; $dbuser = "XXXX"; $dbpass = "XXXXXXXX"; $dbname = 'testdb'; $list = shell_exec ("C:\wamp\bin\mysql\mysql5.1.33\bin\mysqldump.exe $dbname --user=$dbuser--password=$dbpass > dumpfile.sql"); ?> I tried both specified full path to mysqldump.exe or just use mysqldump, it s...

Mysqldump with empty result in gzip?

When I output my MySQL Dump Regularly, it outputs a 30MB File. When I use gzip, 0KB. Here is my code: $command = "<path to>mysqldump --opt -h $dbhost -u$dbuser -p$dbpass $dbname | gzip> test.sql.gz"; system($command); Result: test.sql.gz 0 KB --------------------------- $command = "<path to>mysqldump --opt -h $dbhost -u$dbuser -p$...

Rows between two index entries?

Hello stackoverflow! First time poster here. I'm having problems re-importing a database dump made by mysqldump. I ran mysqldump with the order-by-primary option, and I had it run on a table with a unique key (and no explicit primary key, so it sorted by that unique key). My objective in this case was to re-create the table, making the u...

Efficiently clone a MySQL database on another server

We need to regularly create a clone of a production server's live MySQL 4 database (only one schema) and import it on one or more development databases. Our current process is to 'mysqldump' the database, copy it via ssh and restore it on the target machine using the 'mysql' client utility. Dumping and copying is relatively fast, but re...

Copying MySQL table data to another table

I want to copy the data from one MySQL table to another table. The source table contains 30 million records. the SQL connection gets lost when I tried to copy the data using the SQL query INSERT table2 SELECT * FROM table1 Is there any external tool avaliable to do this job from the shell Thanks Sree ...

How to dump a DESC of each and every table in MySQL (in csv format)

I need to generate CSV files of DESC TableName for few hundred tables in a database. Could you please help me with it guys? I am sure there is a way using Bash script. I tried using mysqldump but it is for data dump and sql dump of structure :( Thank you! ...

Selective Export of MySQL database

I have a webapp that spans many different users, each with selective permissions about what they are able to see. The app is built on top of a MySQL database. One feature I am interested in providing to my "power users" is a sql dump of all their data so that they can run off and do their own things with it. Now I can't just use mysql...

mysqldump not restoring data in MySql 5.0.19

I have a production and a development server, each server has its own MySql server. I am not the admin of any server, not installed anything. I need to get the schema and data from the production to the development but myslqdump does not restore any data! I tried to add SET FOREIGN_KEY_CHECKS = 0; without result. Then I removed the onl...

Out-of-sync AUTO_INCREMENT values in development_structure.sql from Rails/MySQL creates diff noise

Our team is developing a Rails app on MySQL and using config.active_record.schema_format = :sql per The Rails Guides. Naturally, our AUTO_INCREMENT values in development_structure.sql get out-of-sync as we develop in parallel. We know that having different values in our databases for AUTO_INCREMENT is not a technical problem. However, i...