Sponsored Content
Top Forums Web Development How do you sync tables in mysql between two different servers? Post 302379642 by muay_tb on Friday 11th of December 2009 09:00:09 AM
Old 12-11-2009
Question How do you sync tables in mysql between two different servers?

Hi all,

I have 2 mysql databases running on two different servers (both can be accessed via ssh to each other).

If I have say table ABC on server 1, how can I sync it with table ABC on server 2 if the number of records is different? Both databases are the same structure though server 2 has more tables.

Please can someone suggest an easy way to sync tables between two servers, one local one remote by naming a table and syncing it? I have tried (being dumb) to scp the MYI, MYD and FRM files over to the other server *thinking* this would work....it does to an extent until Mysql complains when you use the scp'd tables as part of a merge Smilie
 

7 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

TODO: Sync User Tables Between Databases

Need to eventually sync the MY.UNIX userdata to the forums database (and others). Suggestions on the best approach welcome. (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

sync files from two different servers.

I have a directory called UNIX 1 which contains 2 files and uploaded into two different servers. Now I want to check whether the directory contains both the files. If not, then need to sync the directory. Please let me know how to do that in shell scripting. (2 Replies)
Discussion started by: madan1
2 Replies

3. UNIX for Advanced & Expert Users

How to Sync two servers

Hi All, want to sync. two servers , both are having solaris os. If am updating any thing in one server , it will automatically sync. with the other server . Is it possible , if so den how ? (3 Replies)
Discussion started by: natraj005
3 Replies

4. Programming

MySQL: Create a relation between two tables.

Hello everybody, I'm having troubles creating a relation between two tables in a MySQL database. Having two tables, being one which contains users information (username, password, user ID, etc) and the other the one which contains transactions information (operation type, user ID of the user who... (2 Replies)
Discussion started by: semash!
2 Replies

5. Programming

MySQL join four tables!

Hello; I want merge four MySQL tables to get the intersection that have a common field for all of them. Join two tables is fine to me, but my this case is different from common situations and there are not very many discussions about it. Can anybody give me some idea? Thanks a lot! Here is part... (8 Replies)
Discussion started by: yifangt
8 Replies

6. Solaris

Client does not sync date with ntp servers

We had a network problem a couple of days before that caused 1 interface to down and up. But today I have noticed that our date is wrong, our system have 4 servers and the other 3 are OK. I used <date> command, the result is: Fri Jan 2 17:57:55 ICT 1970 I have tried set date to be the same as... (3 Replies)
Discussion started by: salvation3103
3 Replies

7. Solaris

Best practise for keeping cronjobs across 2 servers in sync

Hi all, I have 2 server A and B. B is acting as standby for A. The cronjobs running in A must not be run in B until failover. The activation of cronjobs in B can be manual. In server A, I am doing the following 1) create a cron/job script that does "crontab -l >... (5 Replies)
Discussion started by: javanoob
5 Replies
MYSQLHOTCOPY(1) 					       MySQL Database System						   MYSQLHOTCOPY(1)

NAME
mysqlhotcopy - a database backup program SYNOPSIS
mysqlhotcopy arguments DESCRIPTION
mysqlhotcopy is a Perl script that was originally written and contributed by Tim Bunce. It uses FLUSH TABLES, LOCK TABLES, and cp or scp to make a database backup. It is a fast way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located. mysqlhotcopy works only for backing up MyISAM and ARCHIVE tables. It runs on Unix. To use mysqlhotcopy, you must have read access to the files for the tables that you are backing up, the SELECT privilege for those tables, the RELOAD privilege (to be able to execute FLUSH TABLES), and the LOCK TABLES privilege (to be able to lock the tables). shell> mysqlhotcopy db_name [/path/to/new_directory] shell> mysqlhotcopy db_name_1 ... db_name_n /path/to/new_directory Back up tables in the given database that match a regular expression: shell> mysqlhotcopy db_name./regex/ The regular expression for the table name can be negated by prefixing it with a tilde ("~"): shell> mysqlhotcopy db_name./~regex/ mysqlhotcopy supports the following options, which can be specified on the command line or in the [mysqlhotcopy] and [client] groups of an option file. For information about option files, see Section 4.2.3.3, "Using Option Files". o --help, -? Display a help message and exit. o --addtodest Do not rename target directory (if it exists); merely add files to it. o --allowold Do not abort if a target exists; rename it by adding an _old suffix. o --checkpoint=db_name.tbl_name Insert checkpoint entries into the specified database db_name and table tbl_name. o --chroot=path Base directory of the chroot jail in which mysqld operates. The path value should match that of the --chroot option given to mysqld. o --debug Enable debug output. o --dryrun, -n Report actions without performing them. o --flushlog Flush logs after all tables are locked. o --host=host_name, -h host_name The host name of the local host to use for making a TCP/IP connection to the local server. By default, the connection is made to localhost using a Unix socket file. o --keepold Do not delete previous (renamed) target when done. o --method=command The method for copying files (cp or scp). The default is cp. o --noindices Do not include full index files for MyISAM tables in the backup. This makes the backup smaller and faster. The indexes for reloaded tables can be reconstructed later with myisamchk -rq. o --password=password, -ppassword The password to use when connecting to the server. The password value is not optional for this option, unlike for other MySQL programs. Specifying a password on the command line should be considered insecure. See Section 6.1.2.1, "End-User Guidelines for Password Security". You can use an option file to avoid giving the password on the command line. o --port=port_num, -P port_num The TCP/IP port number to use when connecting to the local server. o --old_server As of MySQL 5.5.3, mysqlhotcopy uses FLUSH TABLES tbl_list WITH READ LOCK to flush and lock tables. Use the --old_server option if the server is older than 5.5.3, which is when that statement was introduced. This option was added in MySQL 5.5.3. o --quiet, -q Be silent except for errors. o --record_log_pos=db_name.tbl_name Record master and slave status in the specified database db_name and table tbl_name. o --regexp=expr Copy all databases with names that match the given regular expression. o --resetmaster Reset the binary log after locking all the tables. o --resetslave Reset the master.info file after locking all the tables. o --socket=path, -S path The Unix socket file to use for connections to localhost. o --suffix=str The suffix to use for names of copied databases. o --tmpdir=path The temporary directory. The default is /tmp. o --user=user_name, -u user_name The MySQL user name to use when connecting to the server. Use perldoc for additional mysqlhotcopy documentation, including information about the structure of the tables needed for the --checkpoint and --record_log_pos options: shell> perldoc mysqlhotcopy COPYRIGHT
Copyright (C) 1997, 2014, Oracle and/or its affiliates. All rights reserved. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Oracle Corporation (http://dev.mysql.com/). MySQL 5.5 01/30/2014 MYSQLHOTCOPY(1)
All times are GMT -4. The time now is 09:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy