This post details how I added MySQL support to my Ubuntu 12.04 server. I’m running the server on an Amazon EC2 cloud VPS and I’m using Python to interface with the MySQL server. The client gets access to this interface via RESTful web services, static URL requests and RDF SPARQL. This client linking functionality goes beyond the scope of this post, however, and is covered in a number of my previous blog ramblings.
Installing MySQL 5.5
- Open up a shell command prompt in Ubuntu.
- Update all of your previously installed packages.
sudo apt-get update
- Start the installation of MySQL 5.5
sudo apt-get install mysql-server-5.5
- During the installation of MySQL you will be asked to specify a password for the root user. This is the user account that you will use to gain access to all the databases housed in your MySQL store so make sure to remember it for later use.
- And you’re done. MySQL should now be installed. Next we need to add some databases.
- MySQL comes with shell command options that allow you to create databases and structure them. However, this can become a bit tedious. A better way to do all this is to install phpMyAdmin. This PHP-powered web interface does all of the above in a simple GUI-based way. Here’s how you install phpMyAdmin. Note that the following installation requires that you have Apache2 installed on your server with PHP server-side enabled.
- Install phpMyAdmin as follows.
sudo apt-get install phpmyadmin
- During the installation you will be asked to select a web service with which to associate phpMyAdmin. Choose Apache2.
- Select ‘Yes’ when asked if you would like dbconfig-common to configure phpMyAdmin.
- Enter your MySQL root password (see above) when prompted.
- Enter a password that you will use to gain access to the phpMyAdmin system. Keep a record of this.
- Now you want the phpMyAdmin conf file, which has been created during the install, to run every time the Apache2 service starts up. You do this by adding a link to the phpMyAdmin conf to the Apache2’s main conf file.
- Use your favourite text file editor (I use vi) to edit the Apache2 conf file.
sudo vi /etc/apache2/apache2.conf
- Add the following line to the end of the file.
- Finally, restart Apache2.
sudo service apache2 restart
- And that’s it. You should now be able to use a browser to log into phpMyAdmin and from there you can create and organise your databases and tables.