【求助】phpMyAdmin輸入密碼視窗(2)



贊助商連結


頁 : [1] 2

green
2002-03-01, 04:31 PM
為顧及瀏覽便利與問題解決描述單純,故再次發新主題.
phpMyAdmin輸入密碼視窗(1)
http://www.pczone.com.tw/showthread.php?s=&postid=269596#post269596
解決Apache 的.htaccess的問題,但仍未解決phpMyAdmin輸入密碼視窗狀況.:confused: :confused:
===============================================================
依照各位指引與搜尋得知的方式均類似,而我也再次實作卻還是失敗
MySQL 版本 4.0.1-alpha-max-debug安裝於(C:\E_Site\MySQL)
使用 phpMyAdmin 2.2.4來管理。安裝於(C:\E_Site\Apache\htdocs\PHPMyAdmin)
有安裝Apache1323且可正常瀏覽測試頁次也可看到PHPInfo

phpMyAdmin 2.2.4的config.inc.php原始碼如下:與2.2.0有些許不同
$cfgServers[1]['host'] = 'localhost';
$cfgServers[1]['port'] = '';
$cfgServers[1]['socket'] = '';
$cfgServers[1]['connect_type'] = 'tcp';
$cfgServers[1]['stduser'] = '';
$cfgServers[1]['stdpass'] = '';
$cfgServers[1]['auth_type'] = 'config';
$cfgServers[1]['user'] = 'root';
$cfgServers[1]['password'] = '';

phpMyAdmin 2.2.0的config.inc.php原始碼如下:
$cfgServers[1]['host'] = 'localhost';
$cfgServers[1]['port'] = '';
$cfgServers[1]['socket'] = '';
$cfgServers[1]['connect_type'] = 'tcp';
$cfgServers[1]['adv_auth'] = FALSE;
$cfgServers[1]['stduser'] = '';
$cfgServers[1]['stdpass'] = '';
$cfgServers[1]['user'] = 'root';
$cfgServers[1]['password'] = '';

兩者差異在2.2.4少了$cfgServers[1]['adv_auth']這行。
===================================================
執行經過:
1.未更改phpMyAdmin 2.2.4的config.inc.php之下可正常
進入歡迎使用畫面,隨後進入資料庫 mysql - 資料表 user中
增設root的密碼123456,請看附圖一綠框處。附帶一問是否可以刪除
紅框處的使用者,個人認為是可以的。

2.執行〔重新載入 MySQL〕關閉瀏覽器與MySQL。

3.修改phpMyAdmin2.2.4的config.inc.php。增加
$cfgServers[1]['adv_auth'] = true;
$cfgServers[1]['stduser'] = 'root';
$cfgServers[1]['stdpass'] = '123456';
$cfgServers[1]['auth_type'] = 'config';
$cfgServers[1]['user'] = 'root';
$cfgServers[1]['password'] = '123456';

4.重新啟動MySQL並於瀏覽器中鍵入-http://localhost/phpmyadmin/
出現錯誤請看附圖四
MySQL 傳回:
Access denied for user: '[email protected]' (Using password: YES)

5.再次修改phpMyAdmin2.2.4的config.inc.php。
$cfgServers[1]['adv_auth'] = true;
$cfgServers[1]['stduser'] = '';
$cfgServers[1]['stdpass'] = '';
$cfgServers[1]['auth_type'] = 'config';
$cfgServers[1]['user'] = 'root';
$cfgServers[1]['password'] = '123456';
並於瀏覽器中鍵入-http://localhost/phpmyadmin/
出現錯誤請看附圖五
MySQL 傳回: 歡迎使用 phpMyAdmin 2.2.4
Access denied for user: '[email protected]' (Using password: YES)

6.恢復phpMyAdmin2.2.4的config.inc.php預設值
並於瀏覽器中鍵入-http://localhost/phpmyadmin/,則又正常,但檢查
資料庫 mysql - 資料表 user 在 localhost 的帳號設定是正常存在的
==============================================================

該如何處理,才能於瀏覽介面時有彈出視窗來驗證,htaccess的部分藉由
阿土站長與joe.oo網友指引是可以正常運作了。
如此想直接於phpMyAdmin2.2.4設定。

個人於自我學習此部份是新手,儘量描述問題與先自我搜尋與測試再發問,
但還是失敗,故盼能者指點迷津,謝謝!

贊助商連結


hohanliu
2002-03-02, 11:37 AM
小弟我的經驗...
PHP4 如果是使用 CGI 模式,那它的 HTTP 認證並不支援 Win32 的 Apache,
雖然會出現 username & password 的輸入視窗,但其實並不 work...
這個問題我以前在使用 php 4.0.X 的時候遇過。

所以要使用 phpMyAdmin 的 HTTP 認證於 Win32 上,要把 PHP 以 Appche module 的方式
安裝...

另外,這是我的 phpMyAdmin 的 config.inc.php
--------------------------
$cfgServers[1]['host'] = 'localhost';
$cfgServers[1]['port'] = '';
$cfgServers[1]['socket'] = '';
$cfgServers[1]['connect_type'] = 'tcp';
$cfgServers[1]['stduser'] = '';
$cfgServers[1]['stdpass'] = '';
$cfgServers[1]['auth_type'] = 'http';
$cfgServers[1]['user'] = 'root';
$cfgServers[1]['password'] = 'rootpassword';
$cfgServers[1]['only_db']
---------------------------
我的系統:
Windows 2000 Pro, Apache 1.3.23, PHP 4.1.1, MySQL 3.23.47, phpMyAdmin 2.2.4
架於 NAT 之內...

joe.oo
2002-03-02, 09:07 PM
錯在 root 的密碼,
你不能直接把 root 的密碼 (123456) 填在 mysql.user 這個 table 中,
必須先用 PASSWORD() 編碼過.

UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';

phpMyAdmin2.2.4的config.inc.php 照你寫的就可以了,
只是 $cfgServers[1]['adv_auth'] = true; 在 2.2.4 版中已經不須要了.

真的,有空 K 一下 MySQL Reference Manual 的 第六章 "The MySQL access privilege system"

green
2002-03-02, 09:30 PM
謝謝hohanliu與joe.oo的指導
我將進行自我測試與閱讀指定的章節.並隨時回報狀況.

目前又有發生myodbc-25039win95版安裝的問題
發生如附檔般錯誤.而於C:\WINDOWS之下的該檔案是被系統使用中
導致無法安裝,將如何克服?

望請能者再次指導,謝謝

joe.oo
2002-03-03, 08:17 PM
http://www.mysql.com/doc/I/n/Installing_MyODBC.html

green
2002-03-05, 02:05 PM
謝謝hohanliu與joe.oo撥冗說明與張貼,讓我能清楚了解
而我也將於今日依照二位所言,自我測試並回報,
希望待會我張貼的是好消息.

green
2002-03-05, 09:07 PM
依照上述幾則重點於localhost執行均出現如下
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
測試過程如下

Apache之error.log顯示訊息如下
[Tue Mar 05 19:39:20 2002] [error] [client 127.0.0.1]
malformed header from script. Bad header=HTTP/1.0 401 Unauthorized: c:/e_site/php411/php.exe
但是我能以http://localhost/phpinfo.php看到正常資訊

Apache之httpd.conf有關PHP的部分
# And for PHP 4.x, use:
#
ScriptAlias /php/ "C:/E_Site/PHP411/"
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.exe"
AddType application/x-tar .tgz

資料庫 mysql - 資料表 user帳號設定如附圖一。

更改config.inc.php
第一次
$cfgServers[1]['auth_type'] = 'http';
$cfgServers[1]['user'] = 'user1';
$cfgServers[1]['password'] = 'tw0302';
出現如上Internal Server Error錯誤。
第二次
$cfgServers[1]['auth_type'] = 'http';
$cfgServers[1]['user'] = 'user1';
$cfgServers[1]['password'] = '26b09cca2a4a148a';
出現如上Internal Server Error錯誤。

唯有如此才能正常顯示歡迎使用 phpMyAdmin 2.2.4畫面但還是無法有彈出視窗
$cfgServers[1]['auth_type'] = 'config';
$cfgServers[1]['user'] = 'user1';
$cfgServers[1]['password'] = 'tw0302';

不好意思!一直煩勞能者的網友,請撥冗指導。謝謝

green
2002-03-05, 09:11 PM
我下載安裝MyODBC35101.exe之後出現如下畫面
控制台之〔ODBC資料來源〕處顯示與測試連結是成功的,
但是執行winmysqladmin.exe出現卻是Not Found
如此的安裝MyODBC是否已經成功囉,謝謝指導

joe.oo
2002-03-06, 01:16 AM
怎麼愈搞愈複雜, 你不是說, 已經解決 Apache 的.htaccess 的問題.

想要跳出你所謂的 "輸入密碼視窗" , 兩種方法
1. 針對phpMyAdmin所在的 目錄 設限, 也就是 用 .htaccess
2. 目錄不設限, 由 phpMyAdmin 來做.

第一種方法,
當跳出 "輸入密碼視窗" 時, 你所要輸入的帳號/密碼 是那一個 ?
就是用 htpasswd 來製作帳號/密碼檔 那一個 ,
這組帳號/密碼 跟 MySQL 的合法使用者(mysql.user) 沒有直接的關係.
所以, 必須要在 phpMyAdmin 的 config.inc.php 中註明.
$cfgServers[1]['auth_type'] = 'config';
$cfgServers[1]['user'] = 'user1';
$cfgServers[1]['password'] = 'tw0302'; // 這裡的密碼不須編碼
當然 user1 必須是 MySQL 的合法使用者,
因為 phpMyAdmin 往後要用它來連結 MySQL.
如何增加 MySQL 的合法使用者及其權限, 相信你已經 K 過第六章了, 就是那麼簡單.

第二種方法,
利用合法的 MySQL 使用者
當作跳出 "輸入密碼視窗" 時, 你所要輸入的帳號/密碼.
所以, 不必設 .htaccess 也不必用 htpasswd 來製作帳號/密碼檔.
但在 phpMyAdmin 的 config.inc.php 中必須註明:
$cfgServers[1]['auth_type'] = 'http';

green
2002-03-06, 08:59 PM
最初由 joe.oo 發表
怎麼愈搞愈複雜, 你不是說, 已經解決 Apache 的.htaccess 的問題.

想要跳出你所謂的 "輸入密碼視窗" , 兩種方法
1. 針對phpMyAdmin所在的 目錄 設限, 也就是 用 .htaccess
2. 目錄不設限, 由 phpMyAdmin 來做.
第二種方法,
利用合法的 MySQL 使用者
當作跳出 "輸入密碼視窗" 時, 你所要輸入的帳號/密碼.
所以, 不必設 .htaccess 也不必用 htpasswd 來製作帳號/密碼檔.
但在 phpMyAdmin 的 config.inc.php 中必須註明:
$cfgServers[1]['auth_type'] = 'http';

感謝joe.oo不厭其煩再次指引.

我就是在接受指引之後已經解決 Apache 的.htaccess 的問題.而又
剔除.htaccess機制.
轉而進行第二種直接在phpMyAdmin卻屢試屢敗,故又發問.
我也依照屢次指引方式測試還是無法有彈出視窗.再次附圖,依此還是
出現[Internal Server Error],我就不知道如何了?

我的my.ini setup如下一併貼出以利協助
#This File was made using the WinMySQLAdmin 1.3 Tool
#2002/3/2 PM 07:48:10
#Uncomment or Add only the keys that you know how works.
#Read the MySQL Manual for instructions
[mysqld]
basedir=C:/E_SITE/MYSQL
#bind-address=192.168.1.0
datadir=C:/E_SITE/MYSQL/data
#language=C:/E_SITE/MYSQL/share/your language directory
#slow query log#=
#tmpdir#=
#port=3306
#set-variable=key_buffer=16M

[WinMySQLadmin]
Server=C:/E_SITE/MYSQL/bin/mysqld-opt.exe
user=user1
password=tw0302
====================================================
再次煩擾不好意思,期望能再次撥冗支援,我真的不知道該如何才能以phpMyAdmin 來做
才有彈出視窗