Questions tagged [mysqldump]

mysqldump : MySQL's Client Backup Utility

mysqldump is the client backup program used to dump a database or a collection of databases for backup or transfer to another SQL server.

The output of a mysqldump typically contains SQL statements to create the database schema, only the data, stored procedures, triggers, subsets of data using where clauses, or combinations of them all. Additionally, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

By default, mysqldump will dump all databases alphabetically, and table alphabetically within each database. If you use your imagination, you can find more creative ways to mysqldump data faster using shell scripting in conjunction with background processes. Also by default, mysqldump uses --opt, which specifies --add-drop-table, --add-locks, --create-options, --disable-keys, --extended-insert, --lock-tables, --quick, and --set-charset.

There are many options that control mysqldump's behavior when dumping MyISAM and InnoDB data, plus accommodations for making the mysqldump's output perform Binary Log Rotation on the Master prior to dumping and preparing Replication Slaves to change replication coordinates (master Log file,master log position) during reload.

53 questions
67
votes
5 answers

Escaping a password using mysqldump console

I am running a mysqldump via a bash script and have encountered a problem with a password that contains special characters. mysqldump -hlocalhost -uUSERNAME -pPA$$W0RD DATABASE | gzip >…
psx
  • 1,895
13
votes
4 answers

installation mysqldump

i use linux ubuntu..i try to copy db and type some mysqldump command.. but at terminal show: The program 'mysqldump' can be found in the following packages: * mysql-client-5.0 * mysql-client-5.1 Try: sudo apt-get install bash:…
klox
  • 541
6
votes
1 answer

mysqldump alternatives --hex-blob doesn't convert geometry binary columns to hex

I'm trying to create a mysqldump in utf8 encoding. The table I'm trying to dump contains geometry columns. Now, when I use the --hex-blob option, the geometry columns don't get converted to hex. Are there any command line alternatives to mysqldump…
6
votes
1 answer

how to use mysqldump?

I want to copy my database qdbase server. It is located at: qa@qaubuntu:~$ /var/lib/mysql/qdbase On the client PC, I want it located at: qa@qadesktop:~$ /home/qa/html Everyone tells me to use mysqldump. How do I use that because I've never learnt…
klox
  • 541
5
votes
2 answers

Shell script of mysqldump works fine when run manually, but does not run in the cron job?

I have a shell script to get a MySQL database dump. This script works fine when run manually #!/bin/sh fqn=/home/Mysqluser/daily_dumps/bookstore_`date +%Y%m%d_%H%M%S`.sql.gz mysqldump -u root -h localhost -pmysql#passwd bookstore | gzip > $fqn But…
4
votes
1 answer

How to dump and compress MySQL database in Windows only using command line

Is it possible to backup and compress just like in Linux: mysqldump --all-databases | lzma > all.sql.gz I only have smb:// and cmd.exe access via winexe, so no GUI (remote desktop is not enabled, it requires kerberos or something), and phpmyadmin…
Kokizzu
  • 1,807
4
votes
3 answers

How to tune MySQL for restoration from MySQL dump?

My little 5GB database which takes 5 minutes to dump via mysqldump, takes 9 hours to restore. Luckily I found this out during a test-run, not an actual emergency situation. What are the best parameters to optimize to speed this up? I have tried the…
Alex R
  • 1,862
3
votes
1 answer

MySQL - Avoid table locks during backup

I am running nightly backups on my server using mysqldump. Unfortunately that pretty much kills my site for half an hour or so every night, since the tables are getting locked during the backup. According to the processlist it even seems like…
Nils
  • 213
3
votes
1 answer

mysqldump on windows with mysql 8 community

I have MySQL 8.0.26 installed but when I type mysqldump in PowerShell I get a The term 'mysqldump' is not recognized error. When I open up the installer everything is installed. Back in the day mysqldump would have been in the bin\ directory of a…
neubert
  • 7,574
  • 39
  • 94
  • 156
3
votes
2 answers

Where Are Databases Located - MySQL File Location

I just installed a CRM application with a MySQL database. I thought I new the name of the database but I can't find it. Now I am trying to perform a mysqldump but I don't know the name of my database or where it's located. Most docs I read assume…
nicorellius
  • 6,815
2
votes
1 answer

Include current timestamp in filename?

I have to create a lot of DB backups manually using mysqldump, for example like this: mysqldump -uroot -proot my-db > my-db.sql I'm wondering if there's an easy way to include the current date or timestamp into the filename, so that the file would…
Louis B.
  • 123
2
votes
1 answer

Crontab command not executed

I have a command in my crontab that doesn't execute correctly, this should backup the database everyday at the specified time. I tried running the command in my terminal and is working properly. To edit my crontab I use crontab -e the current cron…
2
votes
1 answer

mysqldump command when you don't specify path outputs to terminal?

I'm wondering if I don't specify path to mysqldump command, no file will be saved and output will be just seen on terminal screen? Is this correct?
user98645
2
votes
0 answers

Creating database from dump, InnoDB tables created, ISAM tables not

Hey I'm getting a weird issue with mysql dumps on a Linux box Reproducing: Dump from mysql on box 1, the database has a mix of InnoDB and ISAM tables Copy the dump to box 2 Create a new database on box 2 Run: source dumpfrombox1.sql The…
2
votes
4 answers

Can't create a MySQL dump on Windows, fails before password prompt

I'm trying to create a dump of a locally installed MySQL database on my laptop. I am aware of the command: %>mysqldump -u root -p --opt [database name] but I am not able to execute it. I might be missing the obvious here. I open command line…
Topocalma
  • 113
1
2 3 4