Setting up an Ubuntu 12.04 MySQL server

authored by Frank Lynam at 14/08/2013 16:55:51

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

  1. Open up a shell command prompt in Ubuntu.
  2. Update all of your previously installed packages.

	sudo apt-get update
  1. Start the installation of MySQL 5.5

	sudo apt-get install mysql-server-5.5
  1. 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.
  2. And you’re done. MySQL should now be installed. Next we need to add some databases.

Installing phpMyAdmin

  1. 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.
  2. Install phpMyAdmin as follows.

	sudo apt-get install phpmyadmin
  1. During the installation you will be asked to select a web service with which to associate phpMyAdmin. Choose Apache2.
  2. Select ‘Yes’ when asked if you would like dbconfig-common to configure phpMyAdmin.
  3. Enter your MySQL root password (see above) when prompted.
  4. Enter a password that you will use to gain access to the phpMyAdmin system. Keep a record of this.
  5. 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.
  6. Use your favourite text file editor (I use vi) to edit the Apache2 conf file.

	sudo vi /etc/apache2/apache2.conf
  1. Add the following line to the end of the file.

	Include /etc/phpmyadmin/apache.conf
  1. Finally, restart Apache2.

	sudo service apache2 restart
  1. 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.

	http://server_ip/phpmyadmin

Comments

submit