【问题标题】:How to connect to your Prod/Dev database using phpMyAdmin?如何使用 phpMyAdmin 连接到您的 Prod/Dev 数据库?
【发布时间】:2021-11-10 15:22:20
【问题描述】:

我已经在我的 local 环境中使用 phpMyAdmin 一段时间了。 它带有 WAMP 服务器。我很喜欢。我想知道是否可以将我的开发/生产服务器也连接到它。

到目前为止,我使用MySQL WorkBench 已经有一段时间了。我不是很喜欢它。

如果有人对此有任何经验,我希望你不介意给我一些建议/建议以超越这一点。

【问题讨论】:

  • phpMyAdmin 只是一组 php 脚本,仅此而已
  • 您可以使用 phpmyadmin 连接到远程 mysql 服务器 - 您尝试过 RTFM 吗? :-)
  • 我是新手,所以我不知道这一切。 “每个艺术家首先都是业余爱好者。” - 正确的 ?感谢您的提示。
  • @Dagon : 所以这意味着我们可以对吗?
  • @Adrian:谢谢阿德里安。

标签: php mysql phpmyadmin


【解决方案1】:

phpMyAdmin 可以通过在config.inc.php 中设置单个服务器连接详细信息来连接到多个服务器。您需要为每个服务器设置 $cfg['Servers'][$i] 数组。有关详细信息,请参阅 phpMyAdmin wiki:https://wiki.phpmyadmin.net/pma/Multiserver(以下示例的来源)

$cfg['blowfish_secret']='multiServerExample70518';
//any string of your choice (max. 46 characters)
$i = 0;  

$i++; // server 1 :
$cfg['Servers'][$i]['auth_type'] = 'cookie'; // needed for pma 2.x
$cfg['Servers'][$i]['verbose']   = 'no1'; 
$cfg['Servers'][$i]['host']      = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
// more options for #1 ...

$i++; // server 2 :
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['verbose']   = 'no2'; 
$cfg['Servers'][$i]['host']      = 'remote.host.addr';//or ip:'10.9.8.1'
// this server must allow remote clients, e.g., host 10.9.8.%
// not only in mysql.host but also in the startup configuration
$cfg['Servers'][$i]['extension'] = 'mysqli';
// more options for #2 ... 

// end of server sections
$cfg['ServerDefault'] = 0; // to choose the server on startup

确保完全了解你在做什么以及你是如何连接的,你不想仅仅为了使用 phpMyAdmin 而向外界开放对你的数据库的访问。

【讨论】:

    猜你喜欢
    • 2020-01-08
    • 2021-03-31
    • 2012-11-18
    • 2021-05-09
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    • 2016-10-10
    相关资源
    最近更新 更多