2013-02-10 87 views
0

我想隱藏所有的細節(表結構,數據庫設計等)。我該怎麼做,我在Google搜索並獲得了一些信息。如何隱藏mysql中的信息架構

從這一點,我已經改變的config.inc.php內容:

<?php 

/* Servers configuration */ 
$i = 0; 

/* Server: localhost [1] */ 
$i++; 
$cfg['Servers'][$i]['verbose'] = 'localhost'; 
$cfg['Servers'][$i]['host'] = 'localhost'; 
$cfg['Servers'][$i]['port'] = ''; 
$cfg['Servers'][$i]['socket'] = ''; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['user'] = 'root'; 
$cfg['Servers'][$i]['password'] = ''; 
$cfg['Servers'][$i]['AllowNoPassword'] = true; 
$cfg['Servers'][$i]['hide_db'] = 'information_schema'; 

/* End of servers configuration */ 

$cfg['DefaultLang'] = 'en-utf-8'; 
$cfg['ServerDefault'] = 1; 
$cfg['UploadDir'] = ''; 
$cfg['SaveDir'] = ''; 


/* rajk - for blobstreaming */ 
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50; 
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M'; 
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600; 
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M'; 


?> 

但儘管如此,當我去

http://localhost/phpmyadmin/index.php?db=mysql&token=df40bf81f38ce55621e179517c212d62 

我可以看到所有的信息。

對此的任何解決方案?

回答

2

這是已經隱藏。爲什麼它是可用的原因是:

  • 你有沒有密碼。
  • 您尚未註銷您的會話,因此包含會話信息的Cookie將得到驗證,您將被自動重定向到信息(DB,表格)。這是爲了避免每次刷新時都進行登錄。

此外,檢查「allownopassword」條目,如果它設置爲true,它允許沒有密碼的人登錄。嘗試將其設置爲false。

在MySQL設置root密碼(和儘可能的root密碼變量。我高度建議不要在PHP文件把密碼)。

如果你從來沒有設置root密碼對於MySQL服務器,服務器允許您在沒有密碼的情況下以root身份識別。要製作root密碼,請在shell中鍵入以下內容:

$ mysqladmin -u root password NEWPASSWORD 



<?php 

/* Servers configuration */ 
$i = 0; 

/* Server: localhost [1] */ 
$i++; 
$cfg['Servers'][$i]['verbose'] = 'localhost'; 
$cfg['Servers'][$i]['host'] = 'localhost'; 
$cfg['Servers'][$i]['port'] = ''; 
$cfg['Servers'][$i]['socket'] = ''; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['user'] = 'root'; // If you're going to use ROOT for ALL WORK, set a root password and put it below. 
$cfg['Servers'][$i]['password'] = 'PASSWORD'; 
$cfg['Servers'][$i]['AllowNoPassword'] = false; // False! 
$cfg['Servers'][$i]['hide_db'] = 'information_schema'; 

/* End of servers configuration */ 

$cfg['DefaultLang'] = 'en-utf-8'; 
$cfg['ServerDefault'] = 1; 
$cfg['UploadDir'] = ''; 
$cfg['SaveDir'] = ''; 


/* rajk - for blobstreaming */ 
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50; 
$cfg['Servers'][$i]['bs_repository_threshold'] = '32M'; 
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600; 
$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M'; 


?> 

順便說一句,config不密碼保護phpMyAdmin;訪問正確URL的任何人都會直接登錄並可以操作您的服務器。

製作一個.htaccess文件來防止這個!

Order Deny,Allow 
Deny from All 
Allow from YourIPAddress 
+0

+1謝謝,我設置密碼,以根 – FirmView 2013-02-10 01:19:15

+0

感謝,還,添加的.htaccess! – Whippet 2013-02-10 01:22:13

0

編輯的config.inc.php:

$cfg['Servers'][$i]['hide_db'] = '^information_schema|mysql|performance_schema|test$'; 
if(in_array($_GET['db'], array('information_schema', 'mysql', 'performance_schema', 'test'))) { 
    exit; 
}