Install phpMyAdmin The easiest way to install phpmyadmin is through apt-get: sudo apt-get install phpmyadmin
After the installation has completed, add phpmyadmin to the apache configuration. sudo nano /etc/apache2/apache2.conf Add the phpmyadmin config to the file. Include /etc/phpmyadmin/apache.conf Restart apache: sudo service apache2 restart https://e6cb6d558e26c2158b90ce1964709f30a95c150e.googledrive.com/host/0B6hvW6XtZ2CdZ3VvSWU2MG1Pd28/LTdKR.png Security Set Up the .htaccess File sudo nano /etc/phpmyadmin/apache.conf <Directory /usr/share/phpmyadmin> Options FollowSymLinks DirectoryIndex index.php AllowOverride All [...] Configure the .htaccess file With the .htaccess file allowed, we can proceed to set up a native user whose login would be required to even access the phpmyadmin login page. Start by creating the .htaccess page in the phpmyadmin directory: sudo nano /usr/share/phpmyadmin/.htaccess AuthType Basic AuthName "Restricted Files" AuthUserFile /path/to/passwords/.htpasswd Require valid-user Below you’ll see a quick explanation of each line
Now we will go ahead and create the valid user information. Start by creating a htpasswd file. Use the htpasswd command, and place the file in a directory of your choice as long as it is not accessible from a browser. Although you can name the password file whatever you prefer, the convention is to name it .htpasswd. sudo htpasswd -c /path/to/passwords/.htpasswd username FInish up by restarting apache: sudo service apache2 restart Accessing phpMyAdmin phpMyAdmin will now be much more secure since only authorized users will be able to reach the login page. Accessing youripaddress/phpmyadmin should display a screen like this. https://e6cb6d558e26c2158b90ce1964709f30a95c150e.googledrive.com/host/0B6hvW6XtZ2CdZ3VvSWU2MG1Pd28/wODOM.png Fill it in with the username and password that you generated. After you login you can access phpmyadmin with the MySQL username and password. 参考自 https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04 |