同步 MySQL 远程 &使用 phpMyAdmin 的本地数据库

2022-01-05 00:00:00 php mysql phpmyadmin

我有本地 MySQL 数据库,它偶尔会发生变化,当它发生变化时,我想将它与远程数据库同步.我正在使用 PhpMyAdmin 的同步选项.

我已授予所有 IP 远程连接的权限.

问题:当我想使用 PhpMyAdmin 的同步选项将远程数据库与本地数据库同步时.它只显示了数据库结构的差异,两个数据库上的数据也不同,但没有显示出差异.

当我通过单击 Synchronize Database 按钮同步数据库并再次进行同步时.它再次显示相同的结构同步.

见下图

如果有人有其他解决方案,请也告诉我.本地详情操作系统:Windows7软件:EasyPHP12.0远程详细信息服务器:Linux CpanelPhpMyAdmin

解决方案

打开 phpMyAdmin/config.inc.php 并添加这些关于服务器配置"的行.

$i++;$cfg['Servers'][$i]['host'] = '';//远程 MySQL 主机名或 IP 地址$cfg['Servers'][$i]['port'] = '';//MySQL 端口 - 默认端口留空$cfg['Servers'][$i]['socket'] = '';//套接字的路径 - 默认套接字留空$cfg['Servers'][$i]['connect_type'] = 'tcp';//如何连接到 MySQL 服务器('tcp' 或 'socket')$cfg['Servers'][$i]['extension'] = 'mysql';//要使用的 php MySQL 扩展('mysql' 或 'mysqli')$cfg['Servers'][$i]['compress'] = FALSE;//使用压缩协议进行 MySQL 连接$cfg['Servers'][$i]['auth_type'] = 'config';//身份验证方法(基于配置、http 或 cookie)?$cfg['Servers'][$i]['user'] = '';//远程 MySQL 用户$cfg['Servers'][$i]['password'] = '';//远程 MySQL 密码

<块引用>

现在您的 phpMyAdmin 首页上有一个服务器"下拉菜单.选择你的服务器和宾果游戏!

致谢:codejourneymen

而且,有很多例子,也许有帮助:

phpadmin 远程数据库

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

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

解决方案

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

相关文章