• Skip to main content
  • Skip to primary sidebar

DBA Diaries

Thoughts and experiences of a DBA working with SQL Server and MySQL

How to Install MySQL 5.5 on Ubuntu Server 12.04 LTS

January 26, 2014 by Andy Hayes 4 Comments

For this how to, I am going to document how to install MySQL on an installation of Ubuntu 12.04 LTS

Installing it is a very straight forward and quick process and I prefer to use the terminal. If you are running a GUI, you can also install it through the Ubuntu sofware centre. Typically available with the Ubuntu desktop version.

If you are running the desktop version of Ubuntu, fire up a terminal either by clicking on the icon or by pressing Ctrl + Alt + T

It’s a good idea to update your server package cache before proceeding.

[sourcecode language=’sql’]
sudo apt-get update
[/sourcecode]

Then, run
[sourcecode language=’sql’]
sudo apt-get install mysql-server-5.5
[/sourcecode]

Once you have entered the password for sudo access, the installation will proceed. The only thing it will ask you is what to set the root password for MySQL as. You SHOULD set a password up, don’t leave it blank with the intention of doing it later. I would recommend you find a decent password generator too.

Once installation has completed, you just need to check that mysql is running. To do this, run

[sourcecode language=’sql’]
sudo netstat -tap | grep mysql
[/sourcecode]

If MySQL is running you will see output similar to the following:

tcp  0  0 localhost:mysql  *:*  LISTEN  2480/mysqld

Now test that you can login

[sourcecode language=’sql’]
mysql -uroot -p
[/sourcecode]

Type in the root password directly after the -p switch without spaces.

You can also view what packages have been installed by typing:

[sourcecode language=’sql’]
dpkg -l | grep mysql
[/sourcecode]

Which should return output similar to the following:

andrew@ubuntu-1:~$ dpkg -l | grep mysql
ii  libdbd-mysql-perl                4.020-1build2                     Perl5 database interface to the MySQL database
ii  libmysqlclient18                 5.5.35-0ubuntu0.12.04.1           MySQL database client library
ii  mysql-client-5.5                 5.5.35-0ubuntu0.12.04.1           MySQL database client binaries
ii  mysql-client-core-5.5            5.5.35-0ubuntu0.12.04.1           MySQL database core client binaries
ii  mysql-common                     5.5.35-0ubuntu0.12.04.1           MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                     5.5.35-0ubuntu0.12.04.1           MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.5                 5.5.35-0ubuntu0.12.04.1           MySQL database server binaries and system database setup
ii  mysql-server-core-5.5            5.5.35-0ubuntu0.12.04.1           MySQL database server binaries

Job done, you have just installed MySQL 5.5 on Ubuntu 12.04 LTS

Related Posts:

  • How to fix "conversion failed when converting date and/or time from character string"
    How to fix "conversion failed when converting date…
  • sql grouping sets
    Using SQL GROUPING SETS for Multiple GROUP BY…

Filed Under: All Articles, MySQL Administration Tagged With: mysql, ubuntu

About Andy Hayes

Andy Hayes is a DBA working with SQL Server since version 7.0. He has a wonderful wife and two beautiful children. He loves database technology, playing cricket, and blogging. He is passionate about sharing his experiences as a DBA and learning more to further his understanding and knowledge. You can follow me on Twitter, check out my Facebook page or follow me on Google+

Reader Interactions

Comments

  1. Mark Polczynski says

    November 23, 2015 at 9:51 pm

    Excellent article.
    Only change would be the instructions for entering the password after -p without spaces. You should have the user enter the text exactly as you stated, and tell them they will next be prompted for the password. Thank you for posting this Andy.

    Reply
  2. Sreejith says

    July 5, 2016 at 7:42 am

    thank you
    great help i installed mysql on my ubuntu 12.04

    Reply
  3. krish says

    August 23, 2015 at 11:25 am

    thnx a lot

    Reply

Trackbacks

  1. Installing MySQL on Ubuntu 12.04 | Chris' Sandbox says:
    May 1, 2014 at 11:24 pm

    […] In this post I will detail installing MySQL on Ubuntu 12.04 LTS. I will follow guides from posts at digitalocean (just the MySQL part) and dbadiaries. […]

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

Categories

  • All Articles (84)
  • Career Development (8)
  • MySQL Administration (18)
  • MySQL Performance (2)
  • SQL Server Administration (24)
  • SQL Server News (3)
  • SQL Server Performance (14)
  • SQL Server Security (3)
  • SQL Tips and Tricks (21)

Top 10 Popular Posts

  • Using sp_change_users_login to fix SQL Server orphaned users
  • MySQL SHOW USERS? – How to List All MySQL Users and Privileges
  • How to shrink tempdb
  • How to Transfer Logins to Another SQL Server or Instance
  • How to Delete Millions of Rows using T-SQL with Reduced Impact
  • T-SQL – How to Select Top N Rows for Each Group Using ROW_NUMBER()
  • New T-SQL features in SQL Server 2012 – OFFSET and FETCH
  • How to Kill All MySQL Processes For a Specific User
  • Using exec sp_who2 to help with SQL Server troubleshooting
  • How to fix “conversion failed when converting date and/or time from character string”

Recent Posts

  • How to fix “conversion failed when converting date and/or time from character string”
  • Using SQL GROUPING SETS for Multiple GROUP BY Queries in a Single Query
  • How to Setup MySQL Master Master Replication
  • How To Use SQL to Convert a STRING to an INT
  • How to set up MySQL Replication Tutorial

Search

Connect

  • Twitter
  • Facebook
  • RSS

About

  • Cookie Policy
  • Disclaimer
  • About
Copyright ©