It is possible to run MySQL entirely from the command line. This is not reallt difficult, but I find myself making too many typos.
Fortunately, there is solution – phpMyAdmin. phpMyAdmin offers a graphical user interface for your day-to-day MySQL management.
In this post, we are going to add phpMyAdmin to the already available LAMP stack.
Login to you server.
In case you have not updated the sources.list earlier today, run:
sudo apt-get update
Type at the prompt:
sudo apt-get install phpmyadmin php5-mcrypt
As you will understand, phpmyadmin is the core program. php5-mcrypt is an encryption module. The installation of the module will be skipped, in case the module has been installed already.
When you are asked whether you want to continue, hit Enter.
A configuration screen pops-up where you to select your webserver. We have installed Apache, so select ‘apache2’, by clicking the space bar.
<Ok> with the Tab key and hit Enter.
Last but not least, we have to ensure us that the mcrypt module has been enabled:
sudo php5enmod mcrypt
Finally, we need to reload the Apache configuration now that we have enabled a new php5 module:
sudo service apache2 restart
That is it. You have finished the installation of phpMyAdmin.
You can access phpMyAdmin through the address bar of your browser:
Just replace the variable $serverip with the IP address of your server.
Changing the Default phpMyAdmin URL
The default hyperlink to access phpMyAdmin has one drawback. It is default and therefore obvious.
Changing the default will increase the security of our installation. Fortunately, changing the URL is an easy and quick fix.
Enter at the prompt of your server:
sudo nano /etc/phpmyadmin/apache.conf
We have opened the phpMyAdmin’s configuration file for Apache with the Nano text editor.
The second line in this configuration file reads:
Alias /phpmyadmin /usr/share/phpmyadmin
Replace the first phpmyadmin by a word of your choice. Basically, it can be any word acceptable to a browser.
Assuming that you have picked ‘myphpadmin’, the second line would read like this:
Alias /myphpadmin /usr/share/phpmyadmin
Save you file.
Since, we have changed a configuration file, so we have to restart or reload Apache in order for the changes to take effect:
sudo service apache2 reload
Now you can access phpMyAdmin over the link http://$serverip/myphpadmin. A link that only you are aware of.
And in case you can not recall it someday, just check the apache.conf file.