2017年1月16日 星期一

Using phpMyAdmin and restrict root account login location

目的:

  • allowing all local users access
  • restricting root to local system access
  • restricting root to local network access

方法:

開啟C:\xampp\phpMyAdmin\config.inc.php,填入下方規則


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// disable root access to phpmyadmin
//$cfg['Servers'][$i]['AllowRoot'] = false;

// setting root only access from localhost
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
 // deny everyone by default
 //'deny % from all',
 'deny root from all',

 // allow all users from the local system
 'allow % from localhost',
 'allow % from 127.0.0.1',
 'allow % from ::1',

 // allow all users from the server IP (commented out)
 // 'allow % from SERVER_ADDRESS',

 // allow user root from local system
 'allow root from localhost',
 'allow root from 127.0.0.1',
 'allow root from ::1',
 
 // allow user root from local network
 'allow root from 10.0.0.0/8',
 'allow root from 172.16.0.0/12',
 'allow root from 192.168.0.0/16',
 'allow root from fe80::/10', // IPv6 Link-local Addresses
 'allow root from fc00::/7' // IPv6 Unique Local Addresses

 // add more usernames and their IP (or IP ranges) here - 
    );


reference:
https://docs.phpmyadmin.net/en/latest/config.html#cfg_Servers_AllowDeny_rules
http://www.devside.net/guides/windows/phpmyadmin

沒有留言:

張貼留言