Introduction
MYSQL is an open-source database management system, commonly installed as part of the popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its data. But, let us see installing MySql on Ubuntu 14.04.
In this we learn how to install MYSQL version 5.5, 5.6 on a Ubuntu 14.04 server.
Step 1 — Installing MySQL
There are two ways to install MySQL. You can either use one of the versions included in the APT package repository by default (which are 5.5 and 5.6), or you can install the latest version (currently 5.7) by manually adding MySQL’s repository first.
To install MySQL this way, update the package index on your server and install the package with apt-get.
- sudo apt-get update
- sudo apt-get install mysql-server
You’ll be prompt to create a root password during the installation. Choose a secure one and make sure you remember it, because you’ll need it later.
Installing MySQL 5.5 or 5.6
If you want to install MySQL 5.5 or 5.6 specifically, the process is still very straightforward. First, update the package index on your server.
- sudo apt-get update
Then, to install MySQL 5.5, install the mysql-server-5.5 package.
- sudo apt-get install mysql-server-5.5
To install MySQL 5.6, install the mysql-server-5.6 package instead.
- sudo apt-get install mysql-server-5.6
For both options, you’ll be prompt to create a root password during the installation. Below is the image for reference
​
​
Step 2 — Configuring MySQL
First, you’ll want to run the included security script. This changes some of the less secure default options for things like remote root logins and sample users.
- sudo mysql_secure_installation
You’ll be prompt to enter your current password. Enter the root MySQL password set during installation:
Enter current password for root (enter for none):
Then, assuming you set a strong root password, go ahead and enter nat the following prompt:
Change the root password? [Y/n] n
Remove anonymous users, Y:
Remove anonymous users? [Y/n] Y
Disallow root logins remotely, Y:
Disallow root login remotely? [Y/n] Y
Remove test database and access to it, Y:
Remove test database and access to it? [Y/n] Y
And reload privilege tables, Y:
Reload privilege tables now? [Y/n] Y
Step 3: Verify MySQL Installation
You can check the version of the MySQL installation with the following command:
MYSQL -V
Enter the MySQL command client:
mysql -u user name -p
You will be prompt for root password for MYSQL:
Enter password:
And it will display with following message
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 47
Server version: 5.5.40-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>
Exit the command line with the following command:
exit
To stop MySQL:
service mysql stop
To start MySQL:
service mysql start
To check the status of MySQL:
service mysql status
To restart MySQL:
Service mysqld restart
Sources:-
http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/
Hope this article helps you, if any queries you can comment below.
The Best VPS Hosting Service in India
We at FastWebHost India provides amazing VPS hosting service. It's a real value for money web hosting service you ever find. We support 24/7 no matter what. Give us a try and see yourself.