How to install MySQL and PHPMyAdmin on your Raspberry Pi

Before installing  mysql and Phpmyadmin, make sure you have followed all the steps in my previous article about installing Apache and Php .

First make sure that you have installed all the updates and upgrades by running:
sudo apt-get update -y && sudo apt-get upgrade.

Then run: sudo apt-get install php5 php-pear php5-xcache to install the support packs for php.

Proceed  installing the package for database connectivity : sudo apt-get install php5-mysql

Now we will install MySQL Server : apt-get install mysql-server mysql-client

During installation you will be asked to enter a root password and confirm it.

This is the password you use to connect to your server : mysql -uroot -pso make sure you write it down to remember it.

Let’s now proceed with PhpMyAdmin installation.

Run: sudo apt-get install phpmyadmin . A screen will pop to choose your web server. Choose apache2 and press OK. Then this screen will appear. Select Yes.
When installation finishes, you will be asked to fill in a password. Choose a password and confirm it. This will be the root password that you use to log into phpmyadmin.

Further more, you need to allow your apache server to access the phpmyadmin. Type sudo nano /etc/apache2/apache2.conf and hit Enter. Navigate to the end and add the line : Include /etc/phpmyadmin/apache.conf.
Finally run: /etc/init.d/apache2 restart to restart your server.

That’s all. You are ready to access your base. Just type in your browser : http://"your raspberry ip"/phpmyadmin. and you’re ready to go!

Leave a Reply

Your email address will not be published. Required fields are marked *