21

I have local MySQL database which changes occasionally, when it changes I want to synchronize it with Remote database. I am using PhpMyAdmin's synchronize option for it.

I have given permissions to all IP to connect remotely.

Problem: When I want to synchronize remote database with local database using synchronize option of PhpMyAdmin. It only shows the database structure difference but data is also different on both the databases but it is not showing that difference.

And when I synchronize the database by clicking Synchronize Database button and again do synchronization. It again shows same structure synchronization.

See image below enter image description here

If anyone have alternate solution for it please also tell that. Local Details OS: Windows7 Software: EasyPHP12.0 Remote Details Server: Linux Cpanel PhpMyAdmin

6
  • Are trying to connect and manage a remote MySQL? Commented Feb 2, 2013 at 11:55
  • yes i want to connect remote to local Commented Feb 2, 2013 at 12:00
  • Google search for MySQL replication. Commented Feb 6, 2013 at 5:40
  • I know about replicaton. I am using shared hosting and there is no replication option on my remote PhpMyAdmin Commented Feb 6, 2013 at 7:29
  • You can check this post which may help you: stackoverflow.com/questions/8984517/… Commented Feb 15, 2013 at 6:04

5 Answers 5

16

Open phpMyAdmin/config.inc.php and add these lines about "Server Configuration".

$i++;
$cfg['Servers'][$i]['host']          = '<remote-server-address>'; // Remote MySQL hostname or IP address
$cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension']     = 'mysql';     // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection
$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user']          = '<db-username>';     // Remote MySQL user
$cfg['Servers'][$i]['password']      = '<db-password>';     // Remote MySQL password

Now there is a 'servers' dropdown on your phpMyAdmin front page. Pick your sever and bingo!

Credits: codejourneymen

And, there are a lot of example, maybe help:

phpadmin remote database

Sign up to request clarification or add additional context in comments.

2 Comments

This is good. But I want to add records from local database to remote database if they are not exist there.
You can use the phpMyAdmin interface to do it after connecting the remote server as explained above.
6
+25

My answer is not related to PhpMyAdmin, but anyway, let me recommend you Schema/Data comparison tools in dbForge Studio for MySQL. These tools will help you to find, view differences and synchronize two databases.

If you do not have access to remote database, then you may use HTTP tunnel connection, or use SSL/SSH security connection.

Comments

2

Try using SQLyog Job Agent (SJA) On Windows, it’s available with the award-winning MySQL GUI SQLyog. The Linux version of SJA is free, and can be downloaded from webyog.com

Check here

2 Comments

I don't want to use these third party tools. I want to synchronize using PHP code first.
The "free" community edition doesn't offer sync tools !
1

While creating tables I would let the remote server to use even numbers and let local server to add odd numbers for auto increment. Then have a script to pull or push data between servers without any duplicate problems.

Comments

1

I don't understand why you would not just update the remote and ditch the local DB all together. Suggestion: You might want to set up two remotes - EX: dev.domain.com, www.domain.com. link local code to the dev and update/test then when you want to go to production just data dump dev on www DB. Safe and fallback ready when local DB goes down.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.