修改phpmyadmin中config.inc.php
// Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['auth_type']     = 'cookie';    
// MySQL user
$cfg['Servers'][$i]['user']          = 'root';      
// MySQL password (only needed with 'config' auth_type)
$cfg['Servers'][$i]['password']      = '';          
若将PHP安装为模块方式,则用http,否则用cookie

解决方案 »

  1.   

    这是phpmyadmin自带的用户认证,必需要输入mysql数据库的用户和密码才可以访问,别人不知道用户名和密码,当然就无法访问了。
      

  2.   

    还可以把phpmyadmin目录改名,别人不就无法访问到了吗!
      

  3.   

    还有一点不明白。我的配置文件里本来就有这些是不是不用加了。
    $cfgServers[1]['host']          = 'localhost'; // MySQL hostname
    $cfgServers[1]['port']          = '';          // MySQL port - leave blank for default port
    $cfgServers[1]['socket']        = '';          // Path to the socket - leave blank for default socket
    $cfgServers[1]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
    $cfgServers[1]['stduser']       = '';          // MySQL standard user settings (this user must have read-only
    $cfgServers[1]['stdpass']       = '';          //   access to the "mysql/user" and "mysql/db" tables)
    $cfgServers[1]['auth_type']     = 'config';     // Authentication method (config, http or cookie based)?
    $cfgServers[1]['user']          = 'root';      // MySQL user
    $cfgServers[1]['password']      = '';          // MySQL password (only needed with 'config' auth)
    $cfgServers[1]['only_db']       = '';   我本地机器访问phpadmin并没有要求输入密码,是不是外界访问会要输入密码。
    还有就是如果我把phpmyadmin的目录名字改了是不是要在相关的配置文件里改动相应设置?如apache.
      

  4.   

    phpteam不是已经回答你了,要把
    $cfgServers[1]['auth_type']     = 'config';
    ==>
    $cfgServers[1]['auth_type']     = 'cookie';
    这样访问phpMyAdmin时就需要身分认证了。你改一下试试先。还有就是如果我把phpmyadmin的目录名字改了是不是要在相关的配置文件里改动相应设置?如apache.
    如果你真的要这么做,只用把phpMyAdmin目录下config.inc.php文件中的
    $cfg['PmaAbsoluteUri'] 的值改成你新的phpMyAdmin的路径就可以了。
      

  5.   

    防止外人访问的方法:
    将$cfg['PmaAbsoluteUri']
    设成
    http://localhost/******如果别人访问你的机器,输入密码后进入,执行任何的操作都会被转到
    localhost.....
    而localhost顾名思义,你的localhost只有你才能访问。
      

  6.   

    谢谢各位的解答,我把config改成了http,但是无论输入用户名什么都可以访问,看看我设置的对吗?
    $cfgServers[1]['host']          = 'localhost'; // MySQL hostname
    $cfgServers[1]['port']          = '';          // MySQL port - leave blank for default port
    $cfgServers[1]['socket']        = '';          // Path to the socket - leave blank for default socket
    $cfgServers[1]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
    $cfgServers[1]['stduser']       = '';          // MySQL standard user settings (this user must have read-only
    $cfgServers[1]['stdpass']       = '';          //   access to the "mysql/user" and "mysql/db" tables)
    $cfgServers[1]['auth_type']     = 'http';     // Authentication method (config, http or cookie based)?
    $cfgServers[1]['user']          = 'root';      // MySQL user
    $cfgServers[1]['password']      = '';          // MySQL password (only needed with 'config' auth)
    $cfgServers[1]['only_db']       = ''; 是不是还有什么地方没有设置?
      

  7.   

    问题解决了,因为我的mysql里有一个any账户,谢谢各位的帮忙!