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
owners.

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
Bye

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:~$ 
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.
sharad@ubuntu:~$

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


Posted

in

by

Tags:

Comments

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

  1. wen Avatar
    wen

    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!

    1. Sharad Chhetri Avatar

      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.

      Regards
      Sharad

  2. ERandall Avatar
    ERandall

    Sharad,

    I used the instructions from the MySQL website which told me to “chown -R mysql .” my installation directory. That directory was ‘/usr/bin’. Has anyone else lost root ownership of their commands (including ‘sudo’, of course), and, if anyone recovered from this, how?

    Stupidly,

    ERandall

    1. ERandall Avatar
      ERandall

      I got myself out of the ownership problem with a PartedMagic rescue disk. But I still have the issue of changing the ownership of the MySQL specific /usr/bin/ files. Can I uninstall and then re-install into a /usr/bin/mysql folder? Using apt-get?

      ERandall

      1. sharad chhetri Avatar

        Hi ERandall,

        Yes please , try with re-installing the MySQL server.

        Regards
        Sharad

  3. Wellington Pereira de Carvalho Avatar
    Wellington Pereira de Carvalho

    Thanks a ton, guy! 😀
    I had a tough time looking or installing MySQL for programming classes.

    You helped me and a lot of people, good sir!
    Thank you so much!

    Sincerely,
    Wellington

  4. felix cama Avatar
    felix cama

    “Cannot start SSH tunnel manager” , when try input in worbench..¿

    1. sagul kv Avatar
      sagul kv

      thanks i got it..

  5. Amar Mujumdar Avatar
    Amar Mujumdar

    Hi Sharad,

    Thanks for the link.

    where the config file is stores if i had install mysql locally in ubuntu using apt-get.

    –Amar

    1. sharad chhetri Avatar

      Hello Amar,

      You can get the configuration files at /etc/mysql/

      Regards
      Sharad

Leave a Reply

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

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

%d bloggers like this: