Installation of MySQL Server 5.7 on Ubuntu 14.04
In previous article we have installed MySQL Version 5.6. In this article I will show you the installation of MySQL Server 5.7 on Ubuntu 14.04.
MySQL is very popular database system for a small to medium size web project. It is developed, distributed, and supported by Oracle Corporation. We can run MySQL on various platforms like Window,Linux,Unix. It is full-featured relational database management system (RDBMS).
Below are the steps to install MySQL Server on Ubuntu.
– Download, Install & Update MySQL Server Repository Package for Ubuntu 14.04
You can download the package using below command.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
devops@devopsservice:~$ wget http://dev.mysql.com/get/mysql-apt-config_0.3.5-1ubuntu14.04_all.deb
--2015-07-20 14:21:15-- http://dev.mysql.com/get/mysql-apt-config_0.3.5-1ubuntu14.04_all.deb
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://repo.mysql.com/mysql-apt-config_0.3.5-1ubuntu14.04_all.deb [following]
--2015-07-20 14:21:21-- http://repo.mysql.com/mysql-apt-config_0.3.5-1ubuntu14.04_all.deb
Resolving repo.mysql.com (repo.mysql.com)... 23.58.251.59
Connecting to repo.mysql.com (repo.mysql.com)|23.58.251.59|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18492 (18K) [application/x-debian-package]
Saving to: ‘mysql-apt-config_0.3.5-1ubuntu14.04_all.deb’
100%[============================================================================================================>] 18,492 --.-K/s in 0.02s
2015-07-20 14:21:22 (1.06 MB/s) - ‘mysql-apt-config_0.3.5-1ubuntu14.04_all.deb’ saved [18492/18492]
devops@devopsservice:~$
|
Install Package using dpkg command
|
1
2
3
|
devops@devopsservice:~$ sudo dpkg -i mysql-apt-config_0.3.5-1ubuntu14.04_all.deb
|
Update Repository
|
1
2
3
|
devops@devopsservice:~$ sudo apt-get update
|
– Install MySQL Server package using apt-get
|
1
2
3
|
devops@devopsservice:~$ sudo apt-get install mysql-server-5.7
|
During Installation it will ask Which MySQL product do you wish to configure. Select Server.
Next It will ask Which Server version do you wish to receive. Select mysql-5.7
In Next Screen click on apply.
It will also ask you to provide the password for MySQL root user. Provide your password.
– Check Installed Version of MySQL
|
1
2
3
|
devops@devopsservice:~$ mysql --version
|
– Login into MySQL Server using command line
After MySQL server installation finish, it will start MySQL service automatically.
|
1
2
3
|
devops@devopsservice:~$ mysql -u root -p
|
– MySQL Service related command
Check status of MySQL Service
|
1
2
3
|
devops@devopsservice:~$ sudo /etc/init.d/mysql status
|
Stop MySQL Service
|
1
2
3
|
devops@devopsservice:~$ sudo /etc/init.d/mysql stop
|
Start MySQL Service
|
1
2
3
|
devops@devopsservice:~$ sudo /etc/init.d/mysql start
|
Restart MySQL Service
|
1
2
3
|
devops@devopsservice:~$ sudo /etc/init.d/mysql restart
|
Below are the list of user related command for MySQL
– Change the password of MySQL user.
You can change the MySQL password using two ways. One is using mysqladmin command and other way is after login to mysql prompt.
1) Change the password using mysqladmin command
Syntax: mysqladmin -u username -p’oldpassword’ password “newpassword”
Example:
|
1
2
3
|
devops@devopsservice:~$ mysqladmin -u root -p'P@ssw0rd@123' password "P@ssw0rd@456"
|
2) Change the password after login to mysql prompt.
Login to MySQL server
|
1
2
3
|
devops@devopsservice:~$ mysql -u root -p
|
Switch to mysql database.
|
1
2
3
|
mysql> use mysql;
|
update mysql root user password
|
1
2
3
|
mysql> update user set password=PASSWORD("P@ssw0rd@789") where User='root';
|
Reload the privileges
|
1
2
3
|
mysql> flush privileges;
|
– Create User
We will create user devops with password Devops@123
|
1
2
3
4
|
mysql> CREATE USER 'devops'@'localhost' IDENTIFIED BY 'Devops@123';
Query OK, 0 rows affected (0.08 sec)
|
Provide access on all the databases to user devops
|
1
2
3
4
|
mysql> GRANT ALL PRIVILEGES ON *.* TO 'devops'@'localhost';
Query OK, 0 rows affected (0.00 sec)
|
– View a List of MySQL Users
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
mysql> SELECT User,Host FROM mysql.user;
+------------------+-----------+
| User | Host |
+------------------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| root | devops |
| debian-sys-maint | localhost |
| devops | localhost |
| root | localhost |
| wordpressuser | localhost |
+------------------+-----------+
7 rows in set (0.00 sec)
|
Thanks for reading. Do let us know if you have any feedback/suggestions.
Let us know if you want us to write us on any particular topic. We will try our best.




浙公网安备 33010602011771号