mysqldiff utility on all tables
I am using the mysql diff tool at http://dev.mysql.com/doc/mysql-utilities/1.3/en/mysqldiff.html
It works great but I have to do this for each table
mysqldiff --difftype=differ --server1=PASSWORD@localhost --server2=root:PASSWORD@localhost pos.phppos_additional_item_numbers:compare.phppos_additional_item_numbers
Is there a way to have this repeat on all tables without writing a script?
If I remove the table names it just compare the name and NOT the schema of tables
mysql
bumped to the homepage by Community♦ 8 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using the mysql diff tool at http://dev.mysql.com/doc/mysql-utilities/1.3/en/mysqldiff.html
It works great but I have to do this for each table
mysqldiff --difftype=differ --server1=PASSWORD@localhost --server2=root:PASSWORD@localhost pos.phppos_additional_item_numbers:compare.phppos_additional_item_numbers
Is there a way to have this repeat on all tables without writing a script?
If I remove the table names it just compare the name and NOT the schema of tables
mysql
bumped to the homepage by Community♦ 8 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
try pt-table-checksum if your server1 and server2 are a master and a slave
– akuzminsky
Aug 28 '15 at 16:28
Did you find a solution to this?
– Jaap
Dec 15 '15 at 10:43
add a comment |
I am using the mysql diff tool at http://dev.mysql.com/doc/mysql-utilities/1.3/en/mysqldiff.html
It works great but I have to do this for each table
mysqldiff --difftype=differ --server1=PASSWORD@localhost --server2=root:PASSWORD@localhost pos.phppos_additional_item_numbers:compare.phppos_additional_item_numbers
Is there a way to have this repeat on all tables without writing a script?
If I remove the table names it just compare the name and NOT the schema of tables
mysql
I am using the mysql diff tool at http://dev.mysql.com/doc/mysql-utilities/1.3/en/mysqldiff.html
It works great but I have to do this for each table
mysqldiff --difftype=differ --server1=PASSWORD@localhost --server2=root:PASSWORD@localhost pos.phppos_additional_item_numbers:compare.phppos_additional_item_numbers
Is there a way to have this repeat on all tables without writing a script?
If I remove the table names it just compare the name and NOT the schema of tables
mysql
mysql
asked Aug 28 '15 at 15:39
Chris MuenchChris Muench
632722
632722
bumped to the homepage by Community♦ 8 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 8 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
try pt-table-checksum if your server1 and server2 are a master and a slave
– akuzminsky
Aug 28 '15 at 16:28
Did you find a solution to this?
– Jaap
Dec 15 '15 at 10:43
add a comment |
try pt-table-checksum if your server1 and server2 are a master and a slave
– akuzminsky
Aug 28 '15 at 16:28
Did you find a solution to this?
– Jaap
Dec 15 '15 at 10:43
try pt-table-checksum if your server1 and server2 are a master and a slave
– akuzminsky
Aug 28 '15 at 16:28
try pt-table-checksum if your server1 and server2 are a master and a slave
– akuzminsky
Aug 28 '15 at 16:28
Did you find a solution to this?
– Jaap
Dec 15 '15 at 10:43
Did you find a solution to this?
– Jaap
Dec 15 '15 at 10:43
add a comment |
1 Answer
1
active
oldest
votes
I found a solution to my problem; here is what I did:
<?php
ini_set('display_errors', 1);
set_time_limit(0);
$db_host = 'localhost';
$db_user = 'root';
$db_password = 'PASSWORD';
$db_1 = $argv[1];
$db_2 = $argv[2];
$verbose = isset($argv[3])? '-'.$argv[3] : '';
$conn = mysqli_connect($db_host, $db_user, $db_password, $db_1);
$show_tables_query = mysqli_query($conn, 'SHOW tables');
$tables = array();
while ($row = mysqli_fetch_assoc($show_tables_query))
{
$tables = $row['Tables_in_'.$db_1];
}
foreach($tables as $table)
{
echo "$tablen*******************************nn";
system("mysqldiff $verbose --difftype=differ --server1=$db_user:$db_password@$db_host --server2=$db_user:$db_password@$db_host $db_1.$table:$db_2.$table");
echo "nn";
}
?>
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f112551%2fmysqldiff-utility-on-all-tables%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I found a solution to my problem; here is what I did:
<?php
ini_set('display_errors', 1);
set_time_limit(0);
$db_host = 'localhost';
$db_user = 'root';
$db_password = 'PASSWORD';
$db_1 = $argv[1];
$db_2 = $argv[2];
$verbose = isset($argv[3])? '-'.$argv[3] : '';
$conn = mysqli_connect($db_host, $db_user, $db_password, $db_1);
$show_tables_query = mysqli_query($conn, 'SHOW tables');
$tables = array();
while ($row = mysqli_fetch_assoc($show_tables_query))
{
$tables = $row['Tables_in_'.$db_1];
}
foreach($tables as $table)
{
echo "$tablen*******************************nn";
system("mysqldiff $verbose --difftype=differ --server1=$db_user:$db_password@$db_host --server2=$db_user:$db_password@$db_host $db_1.$table:$db_2.$table");
echo "nn";
}
?>
add a comment |
I found a solution to my problem; here is what I did:
<?php
ini_set('display_errors', 1);
set_time_limit(0);
$db_host = 'localhost';
$db_user = 'root';
$db_password = 'PASSWORD';
$db_1 = $argv[1];
$db_2 = $argv[2];
$verbose = isset($argv[3])? '-'.$argv[3] : '';
$conn = mysqli_connect($db_host, $db_user, $db_password, $db_1);
$show_tables_query = mysqli_query($conn, 'SHOW tables');
$tables = array();
while ($row = mysqli_fetch_assoc($show_tables_query))
{
$tables = $row['Tables_in_'.$db_1];
}
foreach($tables as $table)
{
echo "$tablen*******************************nn";
system("mysqldiff $verbose --difftype=differ --server1=$db_user:$db_password@$db_host --server2=$db_user:$db_password@$db_host $db_1.$table:$db_2.$table");
echo "nn";
}
?>
add a comment |
I found a solution to my problem; here is what I did:
<?php
ini_set('display_errors', 1);
set_time_limit(0);
$db_host = 'localhost';
$db_user = 'root';
$db_password = 'PASSWORD';
$db_1 = $argv[1];
$db_2 = $argv[2];
$verbose = isset($argv[3])? '-'.$argv[3] : '';
$conn = mysqli_connect($db_host, $db_user, $db_password, $db_1);
$show_tables_query = mysqli_query($conn, 'SHOW tables');
$tables = array();
while ($row = mysqli_fetch_assoc($show_tables_query))
{
$tables = $row['Tables_in_'.$db_1];
}
foreach($tables as $table)
{
echo "$tablen*******************************nn";
system("mysqldiff $verbose --difftype=differ --server1=$db_user:$db_password@$db_host --server2=$db_user:$db_password@$db_host $db_1.$table:$db_2.$table");
echo "nn";
}
?>
I found a solution to my problem; here is what I did:
<?php
ini_set('display_errors', 1);
set_time_limit(0);
$db_host = 'localhost';
$db_user = 'root';
$db_password = 'PASSWORD';
$db_1 = $argv[1];
$db_2 = $argv[2];
$verbose = isset($argv[3])? '-'.$argv[3] : '';
$conn = mysqli_connect($db_host, $db_user, $db_password, $db_1);
$show_tables_query = mysqli_query($conn, 'SHOW tables');
$tables = array();
while ($row = mysqli_fetch_assoc($show_tables_query))
{
$tables = $row['Tables_in_'.$db_1];
}
foreach($tables as $table)
{
echo "$tablen*******************************nn";
system("mysqldiff $verbose --difftype=differ --server1=$db_user:$db_password@$db_host --server2=$db_user:$db_password@$db_host $db_1.$table:$db_2.$table");
echo "nn";
}
?>
edited Sep 7 '18 at 15:56
RDFozz
9,82731430
9,82731430
answered Dec 15 '15 at 15:37
Chris MuenchChris Muench
632722
632722
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f112551%2fmysqldiff-utility-on-all-tables%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
try pt-table-checksum if your server1 and server2 are a master and a slave
– akuzminsky
Aug 28 '15 at 16:28
Did you find a solution to this?
– Jaap
Dec 15 '15 at 10:43