需要密码登录phpmyadmin设置方法
一、使用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需要这几个参数:
$cfg [ 'Servers' ][ $i ][ 'auth_type' ] = 'config' ; //授权模式 $cfg['Servers'][$i]['user'] = 'root'; //mysql教程登陆用户 $cfg['Servers'][$i]['password'] = '12345'; //mysql登陆用户密码 将config.inc中,改成
$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
更详细的教程: 打开phpMyAdmin中libraries文件找到config.default.php并打开.
找到$cfg['servers'][$i]['user'] = ' ',在' '中加入'root',找到$cfg['servers'][$i]['password'] = ' ',在' '中加入'123456';这两个地方的修改就是加入刚才安装的Mysql的用户名和密码,读者可自行修改.
这个是配置文件也要修改一下,config.inc.php:
<?php * Servers configuration */ $i = 0; /* * First server */ $i ++; /* Authentication type */ $cfg [ 'Servers' ][ $i ][ 'auth_type' ] = 'cookie' ; /* Server parameters */ $cfg [ 'Servers' ][ $i ][ 'host' ] = 'localhost' ; $cfg [ 'Servers' ][ $i ][ 'connect_type' ] = 'tcp' ; $cfg [ 'Servers' ][ $i ][ 'compress' ] = false; /* Select mysqli if your server has it */ $cfg [ 'Servers' ][ $i ][ 'extension' ] = 'mysql' ; /* User for advanced features */ $cfg [ 'Servers' ][ $i ][ 'controluser' ] = '' ; //用户名 $cfg [ 'Servers' ][ $i ][ 'controlpass' ] = '' ; //密码 /* Advanced phpMyAdmin features */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma_relation'; // $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; /* * End of servers configuration */ /* * Directories for saving/loading files from server */ $cfg [ 'UploadDir' ] = '' ; $cfg [ 'SaveDir' ] = '' ; ?> 查看更多关于需要密码登录phpmyadmin设置方法 - php环境安装的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did20623