**Getting Started** **As always you will need to have Raspbian installed or a similar operating system installed before we can get started. Be sure to head over to my page on **[[http://pimylifeup.com/noobs-raspberry-pi/|installing Raspbian]]** if you haven't yet learnt how to do this.** **I have broken this tutorial down into two steps, first we will install the web server software and also MYSQL. In the 2nd step we will take a look at installing the PHPMyAdmin. If you have come from the**[[http://pimylifeup.com/raspberry-pi-web-server/|Raspberry Pi web server tutorial]]**, then you can simply skip the first step as you would have already done this.** **Installing Raspberry Pi MYSQL** ***Firstly let's install the mysql server onto the Raspberry Pi.** sudo apt-get install mysql-server ***You will be prompted to enter a password for the root user. Make sure you write this down as we will need to use this to access the MYSQL server and connect PHPMyAdmin to it.** {{wiki:Image1}} ***Now if you want to access and start make changes to the database simply enter the following command:** mysql -u root -p ***It will now prompt you to enter the password we just created.** ***You can now enter MYSQL commands to create, alter, delete databases.** ***You can leave the command line by simply entering ****quit****.** **If you want to be able to interact with MYSQL in Python you will need to install the Python bindings as well. You can do this by entering the following command.** sudo apt-get install python-mysqldb **Now we're done installing the Raspberry Pi MYSQL you may want to install PHPMyAdmin so you have a nice clean interface to work with.** **Installing Raspberry Pi PHPMyAdmin** **You will find that installing Raspberry Pi PHPMyAdmin is very easy to do any won't take long at all. It is even faster if you have already installed the MYSQL database and Apache.** ***I will go on the assumption you have not yet installed apache and PHPMyAdmin. If you have already done my web server tutorial or already have installed just skip this step.** sudo apt-get install apache2 php5 libapache2-mod-php5 ***Now let's install the PHPMyAdmin package, you can do this by entering the following:** sudo apt-get install phpmyadmin ***It will now begin to install. You will be presented with a screen asking the type of web server you want it to run off. Select apache2 as this is the server we just installed.** ***Next we will need to configure PHPMyAdmin to connect a database. (The one we set up previously in installing the Raspberry Pi MYSQL step or the webserver). To do this select yes at the next prompt.** {{wiki:Image2}} ***It will now ask for a password, enter the one we set previously when we set up MYSQL.** ***Next it will ask you to set a password for PHPMyAdmin. You can keep it the same as the password to the MYSQL database or something separate. Make sure you remember it as this is the password you will need to access it.** ***We will also need to setup Apache to include our PHPMyAdmin installation. To do this enter:** sudo nano /etc/apache2/apache2.conf ***Now at the bottom of this file enter the following line:** Include /etc/phpmyadmin/apache.conf **Once done save & exist by pressing CTRL +X and then y.** Don't forget link because web root is at /Work/www/weewx: sudo ln -s /usr/share/phpmyadmin /Work/www/weewx/phpmyadmin ***Now simply restart the Apache service by entering the following command:** sudo /etc/init.d/apache2 restart ***Now you should be able to access the PHPMyAdmin from a browser. To test go to the follow address in your browser. (Replace the IP with your IP. If you don't have it run the command hostname -I on your Pi)** http://192.168.1.108/phpmyadmin {{wiki:Image3}} ***If it's all working, then you're good to go. If you want to learn how to setup WordPress on the Raspberry Pi, then you can find that in my Web Sever tutorial.** **If you want to enable external access to the either PHPMyAdmin or MYSQL then you will need to setup port forwarding. To learn how to do this check out my **[[http://pimylifeup.com/raspberry-pi-port-forwarding/|guide on port forwarding]]**. The ports you will need to forward is 80 for PHPMyAdmin and MYSQL is 3306.**