I originally started working on this guide with the assumption it would be used just for others with a Raspberry Pi. Since I use Raspbian, these commands should work the same with Debian or Ubuntu.
(This guide assumes that you are running all commands elevated, either as the root user or with the sudo command, and that your system is fully up to date.)
While the MySQL database server can be used with just the command line, you may want to use the web-based phpMyAdmin to make things easier. To use phpMyAdmin you should have a web server with PHP already set up.
During its install MySQL will prompt you for its root password. Try to pick a secure passphrase for this. Note that this is for the root account for MySQL, not the root account of your system.
# apt-get install mysql-server
I use phpMyAdmin to manage my MySQL databases. During the installation of phpMyAdmin it will ask you if you wish to have it auto-configure Apache or lighthttp. If you followed my web server guide, we have neither installed (we’re using nginx), so leave both unchecked.
The installer will also ask you for the MySQL root password you created when you installed MySQL. Enter it here.
When the installer asks you to create a password to use for phpMyAdmin’s own database, you can leave that field blank and just press Enter to have it automatically generate a random one (it will only be used by phpMyAdmin, so it’s not too important to remember it).
# apt-get install phpmyadmin
If you followed my web guide, you should already have a web root set up. You can put a symbolic link to phpMyAdmin in the web root with this command (which is all on one line):
# ln -s /usr/share/phpmyadmin /srv/html/default/htdocs/phpmyadmin
You should then be able to bring up phpMyAdmin in your web browser by going to “http://<ip-address>/phpmyadmin”. Log in with the MySQL root account.
(Page ID: 2821)