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 ...
随机推荐
- 51Nod - 1055:最长等差数列 (求最长的等差数列)
N个不同的正整数,找出由这些数组成的最长的等差数列. 例如:1 3 5 6 8 9 10 12 13 14 等差子数列包括(仅包括两项的不列举) 1 3 5 1 5 9 13 3 6 9 12 ...
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
- rsync(五)工作机制
当我们讨论rsync时,我们使用了一些特殊的术语来代表不同的进程以及它们在任务执行过程中所扮演的角色.人类为了更方便.更准确地交流,使用同一种语言是非常重要的:同样地,在特定的上下文环境中,使用固定的 ...
- bzoj2687
整体二分+决策单调性 这个方法已经忘了... 决策单调性是指dp[i]由dp[1]->dp[i-1]更新,那么当dp[j]比dp[k]优且j>k时,对于i->n j都比k优 通过这个 ...
- 安装ubuntu+Windows双系统, Windows启动项消失
这里主要介绍grub分区损坏的问题: 首先介绍最简单的方法, 不确定能不能成功, 但是最好先用此方法, 毕竟最简单如果解决就不用下一个方法了. 1. (1)用U盘做一个ubuntu的镜像, 开机进入U ...
- Python之线程与GIL
前言 以下内容是个人学习之后的感悟,转载请注明出处~ 线程是什么 线程是程序中一个单一的顺序控制流程.进程内一个相对独立的.可调度的执行单元,是系统独立调度和分派CPU的 基本单 ...
- 【219】◀▶ IDL 数学函数说明
参考:Math - Miscellaneous Routines参考:Math - Statistical Tools Routines 01 ABS 绝对值. 02 SQRT 平方根. 03 ...
- C# 计算时间日期
System.DateTime datetime = System.DateTime.Now.AddSeconds(fixtime); // fixtime 是往后的秒数 : datetime是现在时 ...
- Android 4.2开发环境搭建
一.工具 jdk1.7; eclipse 4.3(for java ee); Android SDK; 二.安装JDK并配置 安装略,配置如下: 右击 “我的电脑”->属性->高级系统设置 ...
- 5-2 Windows消息队列 (25分)
5-2 Windows消息队列 (25分) 消息队列是Windows系统的基础.对于每个进程,系统维护一个消息队列.如果在进程中有特定事件发生,如点击鼠标.文字改变等,系统将把这个消息加到队列当中 ...