网站地图    收藏   

主页 > php专栏 > php环境搭建 >

需要密码登录phpmyadmin设置方法

来源:未知    时间:2014-11-25 00:02 作者:xxadmin 阅读:

[导读] 一、使用cookie授权模式 找开config.inc.php,将auth_type改为cookie,然后修改blowfish_secret用一个任意字符串作为cookie的加密字符串,如果没有加密钥匙,系统会显示配置文件现在需要绝密的短语...

一、使用cookie授权模式

找开config.inc.php,将'auth_type'改为'cookie',然后修改'blowfish_secret'用一个任意字符串作为cookie的加密字符串,如果没有加密钥匙,系统会显示"配置文件现在需要绝密的短语密码(blowfish_secret) " ,配置文件如下: $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['blowfish_secret'] = '44e2f5aece2855.93921574'; 修改完毕后,即可出现登录窗口。

二、使用config授权模式

http授权模式的web登陆页面,config需要这几个参数:

  1. $cfg['Servers'][$i]['auth_type'] = 'config';    
  2. //授权模式 $cfg['Servers'][$i]['user'] = 'root';          
  3. //mysql教程登陆用户 $cfg['Servers'][$i]['password'] = '12345';     
  4. //mysql登陆用户密码 

将config.inc中,改成

  1. $cfg['Servers'][$i]['auth_type'] = 'cookie'// Authentication method (config, http or cookie based)? 

注意,不是http 而是 cookie 哦!!!

三、用http授权模式

$cfg['Servers'][$i]['auth_type'] = 'http';http授权模式的登陆窗口

注意事项:如果mysql服务器端采用了4.1以上版本,而客户端连接用的是mysql4.1一下版本,对用户设置密码时注意使用OLD_PASSWORD函数,举例:

mysql > SET PASSWORD = OLD_PASSWORD('12345')

mysql > /G

附录:(以下内容是自己写的)除了上述三种phpmyadmin自带的方法外,还可以使用apache的配置来限制登录,在phpmyadmin目录下放置一个.htaccess文件,指定使用的密码记录文 件。然后用htpasswd来生成密码保存在该密码记录文件中(文件的内容是加密的,使用方法htpasswd /etc/php_passwd username)。

httpd.conf中的内容:phpmyadmin's directory"> AllowOverride AuthConfig 

.htaccess文件的内容:authtype basic authuserfile /etc/php_passwd authname information require valid-user

我们可以看到/etc/php_passwd文件中的内容类似这样:username:2Y2CD6nfJuwL6

更详细的教程:打开phpMyAdmin中libraries文件找到config.default.php并打开.

找到$cfg['servers'][$i]['user'] = ' ',在' '中加入'root',找到$cfg['servers'][$i]['password'] = ' ',在' '中加入'123456';这两个地方的修改就是加入刚才安装的Mysql的用户名和密码,读者可自行修改.

这个是配置文件也要修改一下,config.inc.php:

  1. <?php 
  2. * Servers configuration  
  3. */  
  4. $i = 0; 
  5. /*  
  6. * First server  
  7. */  
  8. $i++;  
  9. /* Authentication type */  
  10. $cfg['Servers'][$i]['auth_type'] = 'cookie';  
  11. /* Server parameters */  
  12. $cfg['Servers'][$i]['host'] = 'localhost';  
  13. $cfg['Servers'][$i]['connect_type'] = 'tcp';  
  14. $cfg['Servers'][$i]['compress'] = false;  
  15. /* Select mysqli if your server has it */  
  16. $cfg['Servers'][$i]['extension'] = 'mysql';  
  17. /* User for advanced features */  
  18. $cfg['Servers'][$i]['controluser'] = ''//用户名  
  19. $cfg['Servers'][$i]['controlpass'] = '';//密码  
  20. /* Advanced phpMyAdmin features */  
  21. // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';  
  22. // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';  
  23. // $cfg['Servers'][$i]['relation'] = 'pma_relation';  
  24. // $cfg['Servers'][$i]['table_info'] = 'pma_table_info';  
  25. // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';  
  26. // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';  
  27. // $cfg['Servers'][$i]['column_info'] = 'pma_column_info';  
  28. // $cfg['Servers'][$i]['history'] = 'pma_history';  
  29. // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; 
  30. /*  
  31. * End of servers configuration  
  32. */ 
  33. /*  
  34. * Directories for saving/loading files from server  
  35. */  
  36. $cfg['UploadDir'] = '';  
  37. $cfg['SaveDir'] = ''
  38. ?> 
  39.  

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论