How To Install and Secure phpMyAdmin on Ubuntu 12.04(MySQL图形管理)
原文参考链接:https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04
安装完成执行
sudo dpkg-reconfigure phpmyadmin
重新设置,选择tcp/ip方式
About phpMyAdmin
phpMyAdmin is an free web software to work with MySQL on the web—it provides a convenient visual front end to the MySQL capabilities.
Setup
The steps in this tutorial require the user to have root privileges on your virtual private server. You can see how to set that up here in steps 3 and 4.
Before working with phpMyAdmin you need to have LAMP installed on your server. If you don't have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up here.
Once you have the user and required software, you can start installing phpMyAdmin on your VPS!
Install phpMyAdmin
The easiest way to install phpmyadmin is through apt-get:
sudo apt-get install phpmyadmin apache2-utilsDuring the installation, phpMyAdmin will walk you through a basic configuration. Once the process starts up, follow these steps:
- Select Apache2 for the server
- Choose YES when asked about whether to Configure the database for phpmyadmin with dbconfig-common
- Enter your MySQL password when prompted
- Enter the password that you want to use to log into phpmyadmin
After the installation has completed, add phpmyadmin to the apache configuration.
sudo nano /etc/apache2/apache2.confAdd the phpmyadmin config to the file.
Include /etc/phpmyadmin/apache.confRestart apache:
sudo service apache2 restartYou can then access phpmyadmin by going to youripaddress/phpmyadmin. The screen should look likethis
Security
Unfortunately older versions of phpMyAdmin have had serious security vulnerabilities including allowing remote users to eventually exploit root on the underlying virtual private server. One can prevent a majority of these attacks through a simple process: locking down the entire directory with Apache's native user/password restrictions which will prevent these remote users from even attempting to exploit older versions of phpMyAdmin.
Set Up the .htaccess File
To set this up start off by allowing the .htaccess file to work within the phpmyadmin directory. You can accomplish this in the phpmyadmin configuration file:
sudo nano /etc/phpmyadmin/apache.confUnder the directory section, add the line “AllowOverride All” under “Directory Index”, making the section look like this:
<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/.htaccessFollow up by setting up the user authorization within .htaccess file. Copy and paste the following text in:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/apache2/.phpmyadmin.htpasswd
Require valid-userBelow you’ll see a quick explanation of each line
- AuthType: This refers to the type of authentication that will be used to the check the passwords. The passwords are checked via HTTP and the keyword Basic should not be changed.
- AuthName: This is text that will be displayed at the password prompt. You can put anything here.
- AuthUserFile: This line designates the server path to the password file (which we will create in the next step.)
- Require valid-user: This line tells the .htaccess file that only users defined in the password file can access the phpMyAdmin login screen.
Create the htpasswd file
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 /etc/apache2/.phpmyadmin.htpasswd usernameA prompt will ask you to provide and confirm your password.
Once the username and passwords pair are saved you can see that the password is encrypted in the file.
FInish up by restarting apache:
sudo service apache2 restartAccessing 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.
Fill it in with the username and password that you generated. After you login you can access phpmyadmin with the MySQL username and password.
By Etel Sverdlov
How To Install and Secure phpMyAdmin on Ubuntu 12.04(MySQL图形管理)的更多相关文章
- Ruby on Rails Session 2: How to install Aptana Studio 3 on Ubuntu 12.04 LTS
Update: An updated version of these instructions for Ubuntu 12.10 (Quantal Quetzal) is available her ...
- ubuntu 12.04 mysql转移目录后 无法 启动
http://www.boyunjian.com/do/article/snapshot.do?uid=com.iteye.xgbjmxn%2Fblog%2F1208086(转,) 我是用ap ...
- Install Ruby on Rails on Ubuntu 12.04 LTS
1:Update package repository. sudo apt-get update 2:Install git and Curl. Git:是一个简单,快速,高效的版本控制系统. ...
- ubuntu 12.04 install docker-engine1.12.3
root@node3:/data/src# cat /etc/issueUbuntu 12.04.4 LTS \n \l root@node3:/data/src# cat /etc/apt/so ...
- Install Asterisk 11 on Ubuntu 12.04 LTS
http://blogs.digium.com/2012/11/14/how-to-install-asterisk-11-on-ubuntu-12-4-lts/ Last week I put up ...
- (转) How to install eclipse in ubuntu 12.04
源地址:http://www.krizna.com/ubuntu/install-eclipse-in-ubuntu-12-04/ Eclipse installation in ubuntu 12. ...
- Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10(转)
Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10 1 get the source code sudo apt-get install ...
- How to install / setup /upgrade PHP 5.5.x on Ubuntu 12.04 LTS
原文:http://www.dev-metal.com/how-to-setup-latest-version-of-php-5-5-on-ubuntu-12-04-lts/ 最近遇到了要在ubunt ...
- How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux
Objective The objective is to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux. This a ...
随机推荐
- 点分治 [IOI2011]Race
BZOJ2599. 放板子.利用agc009-D 代码简洁了很多 #include <bits/stdc++.h> #define N 200005 using namespace std ...
- bzoj 4398 福慧双修——二进制分组
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4398 如果枚举1号点走哪些点出去,就从那些点出发跑多源最短路即可.最短路不会重复经过一条边. ...
- Win10+CUDA9.0+cudnn7.1安装
CUDA下载 cudnn下载 CUDA默认安装即可. cudnn下载解压之后,将对应的文件分别拷贝到CUDA Toolkit中即可: 对应的文件夹为: 若为默认安装,则应分别拷贝到的文件夹如下: C ...
- pytest用例setup和teardown
函数式以下两种: setup_function/teardown_function 每个用例开始和结束调用一次 setup_module/teardown_module setup_modu ...
- Day01:Python入门
一.编程与编程语言 编程的目的是将人类的思想流程按照某种能够被计算机识别的表达方式传递给计算机,从而让计算机能像人脑一样自动执行工作. 能被计算机所识别的表达方式是编程语言,python就是一门编程语 ...
- bzoj3456
分治+ntt 设dp[i]表示i个点的图联通的方案数 那么考虑dp,利用容斥,总-不符合,枚举j=1->i-1,然后考虑不符合,那么考虑和1联通的连通块,剩下的不和1连通,那么dp[i]=2^t ...
- 管理SSIS 日志
转自:http://www.cnblogs.com/biwork/p/biworklog.html 一直准备写这么一篇有关 SSIS 日志系统的文章,但是发现很难一次写的很完整.因为这篇文章的内容可扩 ...
- 免证书发布ipa文件真机测试
首先设备得越狱 众所周知,在Xcode上开发的程序只能在模拟器中运行,如果要放到真机上则要花费99美金购买开发者证书iDP.这严重阻碍了我等草根开发者探索的脚步.写个小程序,同学间分享一下这个小小的愿 ...
- jquery登录的异步验证
//定义一个json var validate = { username : false, pwd : false, pwded : false, verify : false, loginUsern ...
- mysql 三存储引擎
一 什么是存储引擎 mysql中建立的库===>文件夹 库中建立的表===>文件 现实生活中我们用来存储数据的文件有不同的类型,每种文件类型对应各自不同的处理机制:比如处理文本用txt类型 ...