简体   繁体   English

仅使用phpmyadmin进行远程服务器而无需安装本地mysql

[英]Using phpmyadmin for only remote server without having local mysql installation

Edit : My question is different than existing questions because I need a way without installing mysql to local server. 编辑 :我的问题与现有问题不同,因为我需要一种方法,而无需将mysql安装到本地服务器。 Please do not throw blindly duplicate question tags to questions. 请不要盲目地重复问题标签。 Thanks. 谢谢。


Edit 2 : Indeed this is not a duplicate, unlike some people still blindly insisted. 编辑2 :确实这不是重复,不像有些人仍盲目坚持。 I am able to connect to remote server without having mysql-client and server packages on the server and successfully executed queries through phpmyadmin interface after adding a custom line into codebase. 我能够在服务器上没有mysql-client和server包的情况下连接到远程服务器,并在将自定义行添加到代码库后通过phpmyadmin接口成功执行查询。 I have created an issue on phpmyadmin github repository for this problem and also added my solution. 我已经在phpmyadmin github存储库上为此问题创建了一个问题 ,并且还添加了我的解决方案。 I'm going to share my solution in here if this duplicate tag removed. 如果删除了这个重复的标签,我将在这里分享我的解决方案。


Question: 题:

I'm trying to connect a remote mysql server and I've manually downloaded phpmyadmin and unzipped into a custom /phpmyadmin folder. 我正在尝试连接远程mysql服务器,我手动下载了phpmyadmin并解压缩到自定义/ phpmyadmin文件夹中。 I've configured my custom config.inc.php. 我已经配置了我的自定义config.inc.php。

I don't have custom mysql installation and this is not a preferred option. 我没有自定义mysql安装,这不是首选选项。

Same settings are working for my php-mysql application but it does not work for phpmyadmin and I'm getting this error when trying to login to phpmyadmin: 相同的设置适用于我的php-mysql应用程序,但它不适用于phpmyadmin,我在尝试登录phpmyadmin时遇到此错误:

#2002 - Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) — The server is not responding (or the local server's socket is not correctly configured). #2002 - 无法通过套接字'/var/run/mysqld/mysqld.sock'连接到本地MySQL服务器(2) - 服务器没有响应(或者没有正确配置本地服务器的套接字)。

在此输入图像描述

/*
 * Generated configuration file
 * Generated by: phpMyAdmin 4.7.9 setup script
 * Date: Wed, 07 Mar 2018 08:09:19 +0000
 */

/* Servers configuration */
$i = 0;

/* Server: dev-staging [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'dev-staging';
$cfg['Servers'][$i]['host'] = 'external_ip';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['compress'] = true;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'dev_wp_user';
$cfg['Servers'][$i]['password'] = 'dev_password';

/* End of servers configuration */
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['blowfish_secret'] = 'z{<F1!k=CjIVTpg)^wJq;StO?sL{F-^E';
$cfg['DefaultLang'] = 'en';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['connect_type'] = 'tcp';

It looks like that phpMyAdmin cannot use your config.inc.php and is trying to use default localhost connection instead. 看起来phpMyAdmin不能使用你的config.inc.php,而是尝试使用默认的localhost连接。 This could be caused by missing php open tag in the beginning of the file. 这可能是由于文件开头缺少php open标签引起的。 phpMyAdmin suppress output and errors during config file processing, so it maybe complicated to notice if something is wrong with it. phpMyAdmin在配置文件处理期间抑制输出和错误,因此如果出现问题可能很复杂。

I was facing the same issue and find a correct solution. 我遇到了同样的问题并找到了正确的解决方案。

  1. Open installation folder. 打开安装文件夹。
  2. you will see "config.sample.inc.php" 你会看到“config.sample.inc.php”
  3. rename it "config.inc.php" and then open 将其重命名为“config.inc.php”,然后打开
  4. change the $cfg['Servers'][$i]['host'] value with your server address. 使用您的服务器地址更改$cfg['Servers'][$i]['host']值。 In my case, its 192.168.1.102 (i am using nodejs with mysql) 在我的情况下,它的192.168.1.102(我正在使用带有mysql的nodejs)
  5. And then restart xampp,wampp (Apache) or any other php server. 然后重启xampp,wampp(Apache)或任何其他php服务器。
  6. Open http://localhost/phpMyAdmin/index.php 打开http://localhost/phpMyAdmin/index.php 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM