Linux: url打开phpmyadmin, how to access phpmyadmin in lamp

问题:

I have installed LAMP on ubuntu, and I want to acced PhpMyAdmin, and I don’t know it’s URL.

I tried to access this URL : http://localhost/phpmyadmin

解决方法:

Just in case someone doesn’t know this (i didn’t for sometime), after running this command to reconfigure phpmyadmin

sudo dpkg-reconfigure -plow phpmyadmin

如果在Configuring phpmyadmin界面,出现提示 Reinstall database for phpmyadmin? 的话,选址 <NO>, 因为我们不需要重新安装。
然后界面会出现下图的样子,这个时候按一下空格键,就会选中apache2

this screen will appear in your terminal, make sure the * is there inside the brackets [] like this [*] for apache using the Space

Linux: url打开phpmyadmin, how to access phpmyadmin in lamp
Linux: url打开phpmyadmin, how to access phpmyadmin in lamp

注意,默认是空选,选中的时候,应该是有星号的!

Linux: url打开phpmyadmin, how to access phpmyadmin in lamp
Linux: url打开phpmyadmin, how to access phpmyadmin in lamp

oK,现在打开 http://localhost/phpmyadmin 试一下!

 

注意,直接url打开phpmyadmin是不安全的,最好设置一个popup登录:

创建一个a .htaccess 文件 by running the commands below

sudo vi /usr/share/phpmyadmin/.htaccess

然后添加下面内容 Then add the content below in the file and save

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

然后编辑.htpasswd文件

sudo vi /etc/phpmyadmin/.htpasswd

输入id和密码,集成页面可以看这个:http://tools.ikeepstudying.com/htpasswd/ 可以帮助你自动生成!

 

 

更多参考:

Ubuntu 16.04 安装 LAMP Install Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04

Ubuntu 17.04 / 17.10 安装 LAMP, Linux Apache2 Mysql PHP, 以及phpmyadmin, INSTALLING LAMP ON UBUNTU 17.04 / 17.10

 

本文:Linux: url打开phpmyadmin, how to access phpmyadmin in lamp