Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

MySQL Installation on Ubuntu

DZone's Guide to

MySQL Installation on Ubuntu

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

It seems that MySQL was created to be installed on RHEL/CentOS/Fedora...

But what if you are actually using Ubuntu? Well, this is the purpose of the following tutorial:

  1. Trace all old MySQL installations on the servers (yes, some vendors are delivering baseline images with some old MySQL versions)

    sudo dpkg --get-selections | grep -v deinstall | grep -i mysql
    
    sudo apt-get --purge remove libdbd-mysql-perl libmysqlclient18 mysql-client mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 php5-mysql
  2. Get the MySQL repository

     sudo wget -O mysql.deb http://dev.mysql.com/get/mysql-apt-config_0.2.1-1ubuntu14.04_all.deb
  3. Install the repository

    sudo dpkg -i mysql.deb
    
    sudo apt-get update
  4. Install the mysql package (you may need to select the right version and select a root password)

    sudo apt-get -y install mysql-server mysql-client
  5. If you have a pre-configured my.cnf, get it and replace the current my.cnf file. Then you should restart the MySQL. I would recommend you to keep your my.cnf in a code repository like git to manage the versionssudo apt-get -y install git

    sudo git clone wherever tmp && git mv tmp/.git . && rm -rf tmp
    
    sudo service mysql restart
  6. Now it time to recover your database from your backup (if you have one) and back to business...

Keep Performing,

Moshe Kaplan

Download Modern Java EE Design Patterns: Building Scalable Architecture for Sustainable Enterprise Development.  Brought to you in partnership with Red Hat

Topics:

Published at DZone with permission of Moshe Kaplan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}