Sponsored Content
Full Discussion: Mysqldump certain tables
Top Forums UNIX for Dummies Questions & Answers Mysqldump certain tables Post 302750715 by timgolding on Wednesday 2nd of January 2013 09:42:46 AM
Old 01-02-2013
OK so i got round to testing the scripts and there was one error. Just needed a ; for the printf, so it treated the sql commands seperately.

Code:
printf  "DROP TABLE %s;\n" $tbl_names

After this change the scripts worked perfectly.

So thanks very very much for all your help Corona688.
 

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
MYSQLI_AFFECTED_ROWS(3) 						 1						   MYSQLI_AFFECTED_ROWS(3)

mysqli::$affected_rows - Gets the number of affected rows in a previous MySQL operation

       Object oriented style

SYNOPSIS
int$mysqli->affected_rows () DESCRIPTION
Procedural style int mysqli_affected_rows (mysqli $link) Returns the number of rows affected by the last INSERT, UPDATE, REPLACE or DELETE query. For SELECT statements mysqli_affected_rows(3) works like mysqli_num_rows(3). PARAMETERS
o $ link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3) RETURN VALUES
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records were updated for an UPDATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query returned an error. Note If the number of affected rows is greater than the maximum integer value( PHP_INT_MAX ), the number of affected rows will be returned as a string. EXAMPLES
Example #1 $mysqli->affected_rows example Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } /* Insert rows */ $mysqli->query("CREATE TABLE Language SELECT * from CountryLanguage"); printf("Affected rows (INSERT): %d ", $mysqli->affected_rows); $mysqli->query("ALTER TABLE Language ADD Status int default 0"); /* update rows */ $mysqli->query("UPDATE Language SET Status=1 WHERE Percentage > 50"); printf("Affected rows (UPDATE): %d ", $mysqli->affected_rows); /* delete rows */ $mysqli->query("DELETE FROM Language WHERE Percentage < 50"); printf("Affected rows (DELETE): %d ", $mysqli->affected_rows); /* select all rows */ $result = $mysqli->query("SELECT CountryCode FROM Language"); printf("Affected rows (SELECT): %d ", $mysqli->affected_rows); $result->close(); /* Delete table Language */ $mysqli->query("DROP TABLE Language"); /* close connection */ $mysqli->close(); ?> Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); if (!$link) { printf("Can't connect to localhost. Error: %s ", mysqli_connect_error()); exit(); } /* Insert rows */ mysqli_query($link, "CREATE TABLE Language SELECT * from CountryLanguage"); printf("Affected rows (INSERT): %d ", mysqli_affected_rows($link)); mysqli_query($link, "ALTER TABLE Language ADD Status int default 0"); /* update rows */ mysqli_query($link, "UPDATE Language SET Status=1 WHERE Percentage > 50"); printf("Affected rows (UPDATE): %d ", mysqli_affected_rows($link)); /* delete rows */ mysqli_query($link, "DELETE FROM Language WHERE Percentage < 50"); printf("Affected rows (DELETE): %d ", mysqli_affected_rows($link)); /* select all rows */ $result = mysqli_query($link, "SELECT CountryCode FROM Language"); printf("Affected rows (SELECT): %d ", mysqli_affected_rows($link)); mysqli_free_result($result); /* Delete table Language */ mysqli_query($link, "DROP TABLE Language"); /* close connection */ mysqli_close($link); ?> The above examples will output: Affected rows (INSERT): 984 Affected rows (UPDATE): 168 Affected rows (DELETE): 815 Affected rows (SELECT): 169 SEE ALSO
mysqli_num_rows(3), mysqli_info(3). PHP Documentation Group MYSQLI_AFFECTED_ROWS(3)
All times are GMT -4. The time now is 07:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy