phpMyAdmin远程访问 [英] phpMyAdmin Remote Access

查看:226
本文介绍了phpMyAdmin远程访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Ubuntu远程访问phpMyAdmin,而不是通过Ubuntu Droplet(DigitalOcean)上的localhost访问.为此,我需要在/etc/phpmyadmin中更改config.ini.php的设置.

I am trying to access phpMyAdmin from Ubuntu remotely, and not through localhost on the Ubuntu droplet (DigitalOcean). To do this, I need to change the setup of the config.ini.php in /etc/phpmyadmin.

运行以下代码时:

<?php
    $link = mysqli_connect("ip_address", "username", "password", "mysql")
    if (!$link) {
        echo "Error: Unable to connect to MySql" . PHP_EOL;    
        exit;
    }
    echo "Success: Connected to MySQL" . PHP_EOL;
    echo "Host Information: " . mysqli_get_host_info($link) . PHP_EOL;

    mysqli_close($link);
?>

我得到"mysqli_connect():(HY000/2002):在...中的连接被拒绝."

I get "mysqli_connect(): (HY000/2002): Connection refused in ...."

提示在config.ini.php中进行配置,以便我可以使用IP地址进行连接吗?

Tips to configuration in config.ini.php so I can use the ip address to connect?

推荐答案

如果可以的话,我会发表评论.基本上,这就是您所追求的.

I would comment if I could. Basically this is what you are after.

所有主机的MySQL根访问权限

因此,您需要首先授予表mysql特权以用于root用户或用于这种情况的用户名.

So you need to first grant privileges for table mysql to root or the username you are using for this case.

GRANT ALL PRIVILEGES ON mysql.* TO 'username'@'%' IDENTIFIED BY 'password';

然后您需要编辑mysql配置文件

Then you need edit the mysql config file

nano /etc/mysql/mysql.conf.d/mysqld.cnf

注释掉#bind-address = 127.0.0.1,然后保存配置文件.

Comment out #bind-address = 127.0.0.1 then save the config file.

重新启动mysql service mysql restart

Restart mysql service mysql restart

这篇关于phpMyAdmin远程访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆