本地phpmyadmin远程连接服务器端MySQL

来源:互联网 发布:嵌入式linux编程 pdf 编辑:程序博客网 时间:2024/05/22 12:14
方法一:

打开config.inc.php(Linux下在/etc/phpmyadmin/下)

1,更改 $cfg['Servers'][$i]['auth_type'] = 'http'; 为 $cfg['Servers'][$i]['auth_type'] = 'cookie';

2,更改 if (empty($dbserver)) $dbserver = 'localhost';为 if (empty($dbserver)) $dbserver = '服务器端数据库IP地址(或域名)';

3,若链接本地数据库则在最后添加:$cfg['Servers'][$i]['host'] = 'localhost';

方法二:

1,在浏览器中输入:http://localhost/phpmyadmin/setup/

2,点击“新建服务器”,填写表单:

 


服务器名称:主机名称

服务器主机名:主机IP

认证方式:config

config 认证方式的用户名:用户名

config 认证方式的密码:用户密码

3,保存后返回setup界面,点击下载,下载的文件为 config.inc.php

4,将下载的文件 config.inc.php 复制到 /usr/share/phpmyadmin/ 目录下

5,编辑 /usr/share/phpmyadmin/config.inc.php

添加以下代码

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '主机名称';
$cfg['Servers'][$i]['host'] = '主机IP';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = '用户名';
$cfg['Servers'][$i]['password'] = '密码';

http://blog.51yip.com/mysql/1250.html
原创粉丝点击