Home > Database > Mysql Tutorial > body text

phpmyadmin连接远程mysql数据库方法

WBOY
Release: 2016-06-07 17:52:34
Original
1060 people have browsed it

下面总结了phpmyadmin连接远程mysql数据库方法,有需要学习的朋友可参考一下。


对本机的phpmyadmin站点内  phpmyadminconfig.inc.php     文件进行修改


找到这行,将['host'] 后的 'localhost'改为远程数据库IP

 代码如下 复制代码

$cfg['Servers'][$i]['host']            = '192.168.1.10';


注:192.168.1.10  是远程数据库的IP


改完后---开始菜单----运行----cmd(回车)----net stop mysql(回车)--------net start mysql(回车)

这样证明你的phpmyadmin可以连接远程,但是如何mysql不支持远程也是没用用的,下面介绍mysql打开远程连接


首先链接本机的mysql(用ssh登录终端,输入如下命令):

mysql -uroot -p输入密码登陆进去后,输入如下的语句,执行。

 代码如下 复制代码

grant all privileges on *.* to ‘user‘@’%‘ identified by ‘password‘ with grant option;

其中,user是用户名,mysql默认的是root ,password是密码自己设置 。%表示任意主机。这样就允许远程任意一台主机访问


搞定:此时你访问本机的phpmyadmin站点时候输入的用户名密码就是远程数据库的,就可以直接连进去了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!