How to Install MySQL 8 on Ubuntu 19.04

Installation of MYSQL 8 On Ubuntu 19.04

Download Command:

curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb 

Installation Procedure:

Update the apt repository to update all the installed packages

root@linuxhelp:~# apt update
Hit:1 http://security.ubuntu.com/ubuntu disco-security InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu disco InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu disco-updates InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu disco-backports InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
146 packages can be upgraded. Run 'apt list --upgradable' to see them.

Download the SQL package using curl as follows

root@linuxhelp:~# curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 35560  100 35560    0     0  15010      0  0:00:02  0:00:02 --:--:--  519k

Install the package by executing the following command

root@linuxhelp:~# dpkg -i mysql-apt-config_0.8.13-1_all.deb
Selecting previously unselected package mysql-apt-config.
(Reading database ... 142808 files and directories currently installed.)
.
.
.

.
.
.
Preparing to unpack mysql-apt-config_0.8.13-1_all.deb ...
Unpacking mysql-apt-config (0.8.13-1) ...
Setting up mysql-apt-config (0.8.13-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK

Update the apt repository to reload the installed sql package

root@linuxhelp:~# apt update
Hit:1 http://security.ubuntu.com/ubuntu disco-security InRelease
Get:2 http://repo.mysql.com/apt/ubuntu disco InRelease [19.3 kB]
Hit:3 http://in.archive.ubuntu.com/ubuntu disco InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu disco-updates InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu disco-backports InRelease
Get:6 http://repo.mysql.com/apt/ubuntu disco/mysql-8.0 Sources [936 B]
Get:7 http://repo.mysql.com/apt/ubuntu disco/mysql-apt-config amd64 Packages [564 B]
Get:8 http://repo.mysql.com/apt/ubuntu disco/mysql-apt-config i386 Packages [564 B]
Get:9 http://repo.mysql.com/apt/ubuntu disco/mysql-8.0 amd64 Packages [6,711 B]
Get:10 http://repo.mysql.com/apt/ubuntu disco/mysql-tools amd64 Packages [3,501 B]
Get:11 http://repo.mysql.com/apt/ubuntu disco/mysql-tools i386 Packages [961 B]
Fetched 32.5 kB in 6s (5,478 B/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
147 packages can be upgraded. Run 'apt list --upgradable' to see them.

Now, Install the MYSQl server onto the system

root@linuxhelp:~# apt install mysql-server -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libaio1 libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client
  mysql-common mysql-community-client mysql-community-client-core
  mysql-community-server mysql-community-server-core
The following NEW packages will be installed:
  libaio1 libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client

Create a password for root to log in to the mysql database Re-enter the password for root Select Use strong password Authentication As a default authentication plugin

.
.
.
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-server (8.0.16-2ubuntu19.04) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.29-0ubuntu2) ...

Enable the service of mysql

root@linuxhelp:~# systemctl enable mysql

Start the service of mysql

root@linuxhelp:~# systemctl start mysql

Check the status of mysql

root@linuxhelp:~# systemctl status mysql
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: active (running) since Fri 2019-06-07 15:18:27 IST; 1min 13s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
 Main PID: 32229 (mysqld)
   Status: "SERVER_OPERATING"
    Tasks: 38 (limit: 4645)
   Memory: 367.5M
   CGroup: /system.slice/mysql.service
           └─32229 /usr/sbin/mysqld

Jun 07 15:18:26 linuxhelp.com systemd[1]: Starting MySQL Community Server...
Jun 07 15:18:27 linuxhelp.com systemd[1]: Started MySQL Community Server.

Check the version of mysql

root@linuxhelp:~# mysql -V
mysql  Ver 8.0.16 for Linux on x86_64 (MySQL Community Server - GPL)

Secure the mysql using mysql_secure_installation

root@linuxhelp:~# mysql_secure_installation 

Securing the MySQL server deployment.

Enter password for user root: 

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: n
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : yes
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : yes
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : yes
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : yes
Success.

All done! 

With this,Installation of mysql 8 on Ubuntu 19.04 comes to end.

Tag : MySQL Ubuntu
FAQ
Q
What are the features of MYSQL?
A
Relational database system,Client/Server Architecture,SQL Compatability,REplication,User interface,Supported Triggers are few of the features of MYSQL
Q
What are the limitations of MYSQL?
A
A table cannot contain more than 1000 columns and internal maximum key length is 1024 bytes is the major limitation in mysql
Q
IS MYSQL and Oracle same?
A
MySQL and Oracle provide the same architecture with the same relational model.MYSQL provides a GPL software license while Oracle doesnt.
Q
IS MySQL free to use?
A
Yes,MYSQL is free to use.
Q
IS mysql a programming language?
A
SQL stands for Structured Query language and it is a programming language designed for querying data from a database.