Installing the latest MySQL on Ubuntu server
MySQL is an open source and leading database management system, usually installed for the popular Linux, Apache, MySQL, PHP/Python/ Perl stack (LAMP). MySQL makes use of the relational database and Structured Query Language (SQL) to manage the data. MySQL is used to store, secure, and retrieve data for several applications, like e-commerce, logging applications, and including data warehousing. It's most frequently related to web-based applications and online publishing.
To install the most recent version of MySQL, you need to add the repository, install the MySQL software, secure the installation, and often take a look at the MySQL is whether running and responding to commands.
1) Adding of the MySQL Software Repository
The MySQL developers offer a .deb package which is capable of handling configuring and installing the official MySQL software repositories. As the repositories are being set up, you will be able to use Ubuntu's standard apt-get command for installing the software. You can download the .deb file with curl and later install with the dpkg command.
Now you need to download the file and on the server, move towards the directory you can write to:
You need to download the file by using the curl and remember to paste the address you have copied in place of the highlighted portion mentioned below:
curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.3-1_all.deb
Now you need to pass two command line flags to the curl. -O instructs curl output to a file on behalf of the standard output. The L flag will allow the curl to follow HTTP redirects, which is required because the address which has been copied will redirect to another location before the file has been downloaded.
The file has to be downloaded in the current directory and list the files to ensure:
You will be able to see the filename listed:
. . .
Now you will be ready to install:
sudo dpkg -i mysql-apt-config*
dpkg is been utilized for installation, remove, and inspect .deb software packages. The -i flag will represent that you would like to install from the particular file.
The package would have now finished adding the repository. You need to Refresh your apt package cache to create the new software packages which are available:
sudo apt-get update
You need to also clean up after ourselves and delete the file that has been downloaded:
2) Installing the MySQL
Has been added the repository and with the package cache being freshly updated, You can now use apt-get for installing the latest MySQL server package:
sudo apt-get install mysql-server
MySQL should have been installed and running now. You can check it by using systemctl:
systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2016-24-10 17:30:12 UTC; 8min 10s ago
Main PID: 8760 (mysqld)
└─8760 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
The Active: active line is the MySQL which is been installed and running. And you can also make the installation even more secure.
3) Securing the MySQL
MySQL comes with the command that can be used to perform some security-related updates on the new install. Run it by using the below command:
4) Testing of MySQL
mysqladmin is a command line administrative client for the MySQL. You can use it to connect to the server and also output some of the version and the status details:
mysqladmin -u root -p version
The -u root portion will tell the mysqladmin to log in as the MySQL root user, -p instructs the customer to request for the password, and the version is the actual command you have to run.
The output will be helpful in knowing what type of version is the MySQL server is running, its uptime, and some other details of the status:
mysqladmin Ver 8.42 Distrib 5.7.17, for Linux on x86_64
Copyright (c) 2000-2016, Oracle and/or its affiliates. All rights reserved.
Server version 8.2.25
Protocol version 85
Connection Localhost via UNIX socket
UNIX socket /var/run/mysqld/mysqld.sock
Uptime: 25 min 10 sec
If you have been received the same output that means you have been successfully installed the latest MySQL server and it is been secured.