首页 >数据库 >mysql教程 >phpmyadmin连接远程mysql_MySQL

phpmyadmin连接远程mysql_MySQL

WBOY
WBOY原创
2016-06-01 13:02:341075浏览

phpmaadmin连接远程mysql

连接远程mysql步骤

.保证已经有了phpmyadmin,如果没有,去http://www.phpmyadmin.net/home_page/downloads.php下载,安装;文章这里用集成开发环境wamp自带的phpmyadmin示范。 进入到phpmyadmin安装目录下,这里是:C:wampappsphpmyadmin4.1.14,
.创建文件夹config;拷贝.config.inc.php到,configconfig.inc.php
浏览器中执行http://localhost/phpmyadmin/setup,根据自己主题填写host,user,password
.设置保存后,拷贝.configconfig.inc.php到.config.inc.php(原来文件最好能备份一下)

文件config.inc.php

<?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 4.1.14 setup script
 * Date: Wed, 24 Sep 2014 08:15:24 +0200
 */

/* Servers configuration */
$i = 0;

/* Server: 85 [1] */
$i++;
$cfg[&#39;Servers&#39;][$i][&#39;verbose&#39;] = &#39;85&#39;;
$cfg[&#39;Servers&#39;][$i][&#39;host&#39;] = &#39;172.163.25.85&#39;;/*远程数据库主机*/
$cfg[&#39;Servers&#39;][$i][&#39;port&#39;] = &#39;&#39;;
$cfg[&#39;Servers&#39;][$i][&#39;socket&#39;] = &#39;&#39;;
$cfg[&#39;Servers&#39;][$i][&#39;connect_type&#39;] = &#39;tcp&#39;;
$cfg[&#39;Servers&#39;][$i][&#39;extension&#39;] = &#39;mysqli&#39;;
$cfg[&#39;Servers&#39;][$i][&#39;nopassword&#39;] = true;
$cfg[&#39;Servers&#39;][$i][&#39;auth_type&#39;] = &#39;config&#39;;/*认证方式,以配置文件方式认证*/
$cfg[&#39;Servers&#39;][$i][&#39;user&#39;] = &#39;user2&#39;;/*数据库账户*/
$cfg[&#39;Servers&#39;][$i][&#39;password&#39;] = &#39;&#39;;/*密码为空*/、
$cfg[&#39;Servers&#39;][$i][&#39;AllowNoPassword&#39;] = true;/*账户密码为空时,添加此句*/

/* End of servers configuration */

$cfg[&#39;DefaultLang&#39;] = &#39;en&#39;;
$cfg[&#39;ServerDefault&#39;] = 1;
$cfg[&#39;UploadDir&#39;] = &#39;&#39;;
$cfg[&#39;SaveDir&#39;] = &#39;&#39;;
?> 

$cfg['Servers'][$i]['AllowNoPassword']解释

$cfg['Servers'][$i]['AllowNoPassword']

Type: boolean

Default value: false

Whether to allow logins without a password.The default value of false for this parameter prevents unintended access to aMySQL server with was left with an empty password for root or on which ananonymous (blank) user is defined.

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn