How to install mysql server 5.6 on Ubuntu 14.04 LTS ( Trusty Tahr )

In this practical we will learn, how to install mysql server 5.6 on Ubuntu 14.04 LTS ( Trusty Tahr ).At the time of writing this post, MySQL Server has 5.6 version as stable release (release date – 11 April 2014).

MySQL is a open source relational database management system (RDBMS). It is popularly used in LAMP (Linux,Apache,MySQL,PHP) stack with web application. One the most reliable database and many companies are using it .

Install mysql server 5.6 on Ubuntu 14.04 LTS ( Trusty Tahr )

Installing mysql-server 5.6 is very easy. Follow the given below steps

Step 1: Install MySQL Server 5.6

Install mysql-server 5.6 with apt-get command.

sudo apt-get update
sudo apt-get install mysql-server-5.6

During installation of MySQL Server packages,on your terminal you will screen of setting mysql root password. Hence, give the mysql user root password.

Given below is screenshot of screen.

mysql Ubuntu 14.04

Now it will again ask mysql root password for confirmation. Rewrite the same mysql root password which you have given on first screen.

MySQL Server 5.6 Ubuntu 14.04

Step 2 : Login into MySQL Server

After mysql server installation get finishes , it start the mysql service automatically. Hence, you can login now in MySQL Server with user root.

To login into MySQL Server, use the below given command.It will ask the mysql root password which you have set during mysql server installation.

mysql -u root -p

Given below is the reference from my server

sharad@ubuntu:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 36
Server version: 5.6.17-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
3 rows in set (0.04 sec)

mysql> exit

Step 3 :MySQL Service to Start/Stop/Restart/Status

(a) To restart the mysql service

sudo service mysql restart

(b) To start mysql Service

sudo service mysql start

(c) To stop mysql service

sudo service mysql stop

(c) To get status of mysql service

sudo service mysql status

NOTE: For start/stop/restart/status of mysql , use service command.

In case, if you are using init.d script (/etc/init.d/mysql), it will show some error as given below.

sharad@ubuntu:~$ sudo /etc/init.d/mysql restart
 * Stopping MySQL database server mysqld                                                                                                  [ OK ] 
 * Starting MySQL database server mysqld                                                                                                         No directory, logging in with HOME=/
                                                                                                                                          [ OK ]
 * Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly.

Hence, it is good to use service command for start/stop of mysql service

21 thoughts on “How to install mysql server 5.6 on Ubuntu 14.04 LTS ( Trusty Tahr )”

  1. I use xtrabackup to restore my databases,but have something wrong,can you help me solve the problem ?

    this is the code :
    root@48c86b317234:/var/lib/mysql# innobackupex –default-file=/usr/share/doc/mysql-server-5.6/examples/my-default.cnf –copy-back /data/backup/mysql/daily/full.20180907-09:58:01.compressed/
    xtrabackup: recognized server arguments:
    xtrabackup: recognized client arguments:
    encryption: using gcrypt 1.6.5
    180907 03:15:27 innobackupex: Starting the copy-back operation

    IMPORTANT: Please check that the copy-back run completes successfully.
    At the end of a successful copy-back run innobackupex
    prints “completed OK!”.

    innobackupex version 2.4.12 based on MySQL server 5.7.19 Linux (x86_64) (revision id: 170eb8c)
    Error: datadir must be specified.

    I use mysql5.6 ,and dont know the defaults file,thanks!

    • Hi Wen,

      The mysql defualt datadir is /var/lib/myql . I have not checked the command from my end yet but it should have one more parameter to define “datadir” which seems to be missng.



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.