Installing web access for MySQL
In this recipe, we will set up a well-known web-based MySQL administrative tool—phpMyAdmin.
Getting ready
You will need access to a root account or an account with sudo
privileges.
You will need a web server set up to serve PHP contents.
How to do it…
Follow these steps to install web access for MySQL:
- Enable the
mcrypt
extension for PHP:$ sudo php5enmod mcrypt
- Install
phpmyadmin
with the following commands:$ sudo apt-get update $ sudo apt-get install phpmyadmin
- The installation process will download the necessary packages and then prompt you to configure
phpmyadmin
: - Choose
<yes>
to proceed with the configuration process. - Enter the MySQL admin account password on the next screen:
- Another screen will pop up; this time, you will be asked for the new password for the
phpmyadmin
user. Enter the new password and then confirm it on the next screen: - Next,
phpmyadmin
will ask for web server selection: - Once the installation completes, you can access phpMyAdmin at
http://server-ip/phpmyadmin
. Use your admin login credentials on the login screen. Thephpmyadmin
screen will look something like this:
How it works…
PHPMyAdmin is a web-based administrative console for MySQL. It is developed in PHP and works with a web server such as Apache to serve web access. With PHPMyAdmin, you can do database tasks such as create databases and tables; select, insert, update data; modify table definitions; and a lot more. It provides a query console which can be used to type in custom queries and execute them from same screen.
With the addition of the Ubuntu software repository, it has become easy to install PHPMyAdmin with a single command. Once it is installed, a new user is created on the MySQL server. It also supports connecting to multiple servers. You can find all configuration files located in the /etc/phpmyadmin
directory.
There’s more…
If you want to install the latest version of phpMyAdmin, you can download it from their official website, https://www.phpmyadmin.net/downloads/. You can extract downloaded contents to your web
directory and set MySQL credentials in the config.inc.php
file.
See also
- Read more about phpMyAdmin in the Ubuntu server guide at https://help.ubuntu.com/lts/serverguide/phpmyadmin.html
- Install and secure phpMyAdmin at https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-14-04