Sponsored Content
Full Discussion: Mysqldump certain tables
Top Forums UNIX for Dummies Questions & Answers Mysqldump certain tables Post 302742673 by Corona688 on Tuesday 11th of December 2012 12:23:24 PM
Old 12-11-2012
27 megabytes of what? Text from mysqldump? Any sort of compression should shrink that fantastically.

Instead of constantly using root to drop entire databases -- might just be the teensiest bit dangerous Smilie -- just list tables and delete them as the same user.
Code:
mysql -u username database -b --skip-column-names <<EOF > /tmp/$$-tables
SHOW TABLES
EOF

while read table
do
        echo "DROP TABLE $table"
done < /tmp/$$-tables | mysql -u username database
rm -f /tmp/$$-tables

And yeah, you can dump as many tables simultaneously as you want.

Code:
mysqldump -u username database table1 table2 table3 ...

This User Gave Thanks to Corona688 For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

2. Shell Programming and Scripting

mysqldump script without hardcode password

OS: Linux ambglx02 2.6.16.60-0.21-default #1 Tue May 6 12:41:02 UTC 2008 i686 i686 i386 GNU/Linux Shell: bash Currently I have a mysqldump script to backup my mysql database, the command is as below: /opt/novell/mysql/bin/mysqldump --add-drop-table -u root -p -h mydb > /home/john/mydb.sql ... (5 Replies)
Discussion started by: bulkbiz
5 Replies

3. UNIX for Dummies Questions & Answers

mysqldump bus error - cored dumped

hi, I need to backup a database but I'm getting the error "bus error - core dumped" just after I run mysqldump command. The server has installed solaris 9. Any help would be appreciated (3 Replies)
Discussion started by: dahr
3 Replies

4. UNIX for Advanced & Expert Users

mysqldump slowing down the process?

Hi All, I have a data calculation process-a perl script running each and every hour which will do some calculations on the data stored in a mysql server. Normally it tooks around 2minutes (max) to complete. But in case if i did any actions on the linux box where the database is... (7 Replies)
Discussion started by: DILEEP410
7 Replies

5. Shell Programming and Scripting

Help needed for mysqldump command

I want to take a backup of a database and redirect the output of the whole process to a log file. I am using the below command: mysqldump -A --add-drop-table > mysql-daily-backup.sql &> /tmp/backup_log/mysql.log Is there anything wrong with the syntax? ---------- Post updated at 08:32 PM... (0 Replies)
Discussion started by: proactiveaditya
0 Replies

6. UNIX for Dummies Questions & Answers

Problem with my crontab file, using mysqldump

My crontab file tells cron to run a certain shell script at 10:30 AM every day. The shell script backs up my database with mysqldump and then runs a sed script that does some editing of the backup file. I have programmed the shell script to write an error message to a file I have in my home... (1 Reply)
Discussion started by: Ultrix
1 Replies

7. Shell Programming and Scripting

Mysqldump rotate backup

I have a very simple script that uses a cron job to take a daily backup of our orders database. echo "Dumping ORDERS database"; mysqldump -u root --password='mypassword' -h '1.1.1.1' --opt --compress ORDERS $tbl_names > /Volumes/Files_Backup_1/db_backups/orders.sql echo "Copied database to... (2 Replies)
Discussion started by: timgolding
2 Replies

8. Shell Programming and Scripting

Need Help with automatically Import from special mysqldump

Hi @ all I need a little bit help with a tricky problem ... Here´s the situation: We´ve 2 MySQL-Servers, one is productive, the other is Backup. At the productive Server there runs every 2 hours a cron Job which does a Dump from MySQL-DB with script 'automysqlbackup.sh' and copy it then... (7 Replies)
Discussion started by: jackcracker
7 Replies
mysqladmin(1)							  MySQL database						     mysqladmin(1)

NAME
mysqladmin [OPTIONS] command command.... - A utility for performing administrative operations OPTION SYNOPSIS
mysqladmin [-#|--debug= logfile] [-f|--force] [-?|--help] [--character-sets-dir=directory] [-C|--compress] [-h|--host=[#]] [-p[pwd]] [--password=[pwd]] [-P|--port= pnum] [-i|--sleep= sec] [-E|--vertical] [-s|--silent] [-S|--socket= #] [-r|--relative] [-t|--timeout= #] [-u|--user= uname] [-v|--verbose] [-V|--version] [-w|--wait[=retries]] OPTION DESCRIPTION
You can get a list of the options your version of mysqladmin supports by executing mysqladmin --help OPTIONS
-#|--debug=logfile Output debug log. Often this is 'd:t:o,filename` -f|--force Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs -?|--help Display help and exit --character-sets-dir=directory Set the character set directory -C|--compress Use compression in server/client protocol -h|--host=hostname Connect to host -p|--password[=pwd] Password to use when connecting to server If password is not given it's asked from the tty -P|--port=pnum Port number to use for connection -i|--sleep=sec Execute commands again and again with a sleep between -r|--relative Show difference between current and previous values when used with -i extended-status -E|--vertical Print output vertically. Is similar to --relative, but prints output vertically. -s|--silent Silently exit if one can't connect to server -S|--socket=file Socket file to use for connection -t|--timeout=sec Timeout for connection to the mysqld server -u|--user=uname User for login if not current user -v|--verbose Write more information -V|--version Output version information and exit -w|--wait Wait and retry if connection is down COMMAND SYNOPSIS
MySQLADMIN [create databasename ] [drop databasename] [extended-status] [flush-hosts] [flush-logs] [flush-tables] [flush-privileges] [ kill id,id,... ] [password new-password ] [ping] [processlist] [reload] [refresh] [shutdown] [slave-start] [slave-stop] [status] [variables] [version] COMMANDS
Where command is a one or more of: (Commands may be shortened) create databasename Create a new database drop databasename Delete a database and all its tables extended-status Gives an extended status message from the server flush-hosts Flush all cached hosts flush-logs Flush all logs flush-status Clear status variables flush-tables Flush all tables flush-threads Flush the thread cache flush-privileges Reload grant tables (same as reload) kill id,id,... Kill mysql threads password new-password Change old password to new-password ping Check if mysqld is alive processlist Show list of active threads in server reload Reload grant tables refresh Flush all tables and close and open logfiles shutdown Take server down status Gives a short status message from the server variables Prints variables available version Get version info from server SEE ALSO
isamchk(1), isamlog(1), mysql(1), mysqlaccess(1), mysqld(1), mysqld_multi(1), mysqld_safe(1), mysqldump(1), mysql_fix_privilege_tables(1), mysqlshow(1), mysql_zap(1), perror(1), replace(1) For more information please refer to the MySQL reference manual, which may already be installed locally and which is also available online at http://www.mysql.com/doc/en/ BUGS
Please refer to http://bugs.mysql.com/ to report bugs. AUTHOR
Ver 1.0, distribution 4.0.24 Michael (Monty) Widenius (monty@mysql.com), MySQL AB (http://www.mysql.com/). This software comes with no warranty. Manual page by L. (Kill-9) Pedersen (kill-9@kill-9.dk), Mercurmedia Data Model Architect / system developer (http://www.mercur- media.com) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+------------------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+------------------------------------+ |Availability | SUNWmysqlr, SUNWmysqlu, SUNWmysqlt | +--------------------+------------------------------------+ |Interface Stability | External | +--------------------+------------------------------------+ NOTES
Source for mysql is available on http://opensolaris.org. MySQL 4.0 19 December 2000 mysqladmin(1)
All times are GMT -4. The time now is 02:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy