How to Install MySQL on Ubuntu 20.04 - MS TV Life.COM

How to Install MySQL on Ubuntu 20.04

How to Install MySQL on Ubuntu 20.04

We hope this post helped you to find out  How to Install MySQL on Ubuntu 20.04

MySQL is the most well-liked open-source relational database administration system. It’s quick, simple to make use of, scalable, and an integral a part of the favored LAMP and LEMP stacks.

This information explains how one can set up and safe MySQL on Ubuntu 20.04.

Conditions #

Ensure you are logged in as a person with sudo privileges.

Putting in MySQL on Ubuntu #

On the time of writing this text, the most recent model of MySQL obtainable within the Ubuntu repositories is MySQL model 8.0. To put in it run the next instructions:

sudo apt update
sudo apt install mysql-server

As soon as the set up is accomplished, the MySQL service will begin routinely. To confirm that the MySQL server is working, kind:

sudo systemctl status mysql

The output should show that the service is enabled and running:

● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-04-28 20:59:52 UTC; 10min ago
   Main PID: 8617 (mysqld)
     Status: "Server is operational"
     ...

Securing MySQL #

MySQL set up comes with a script named mysql_secure_installation that lets you simply enhance the database server safety.

Invoke the script with out arguments:

sudo mysql_secure_installation

You may be requested to configure the VALIDATE PASSWORD PLUGIN which is used to check the power of the MySQL customers’ passwords and enhance the safety:

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

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: y

There are three ranges of password validation coverage, low, medium, and robust. Press y if you wish to arrange the validate password plugin or some other key to maneuver to the following step:

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

On the following immediate, you’ll be requested to set a password for the MySQL root person:

Please set the password for root here.


New password: 

Re-enter new password: 

When you arrange the validate password plugin, the script will present you the power of your new password. Kind y to verify the password:

Estimated strength of the password: 50 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

Subsequent, you’ll be requested to take away the nameless person, limit root person entry to the native machine, take away the take a look at database, and reload privilege tables. It is best to reply y to all questions.

Login as root #

To work together with the MySQL server from the command line use the MySQL shopper utility which is put in as a dependency of the MySQL server bundle.

On MySQL 8.0, the basis person is authenticated by the auth_socket plugin by default.

The auth_socket plugin authenticates customers that join from the localhost via the Unix socket file. This implies which you can’t authenticate as root by offering a password.

To log in to the MySQL server as the basis person kind:

sudo mysql

You will be presented with the MySQL shell, as shown below:

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 12
Server version: 8.0.19-0ubuntu5 (Ubuntu)

Copyright (c) 2000, 2020, 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>

If you wish to login to your MySQL server as root utilizing an exterior program resembling phpMyAdmin, you’ve gotten two choices.

The primary one is to vary the authentication methodology from auth_socket to mysql_native_password. You are able to do that by working the next command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';FLUSH PRIVILEGES;

The second, recommended option is to create a new dedicated administrative user with access to all databases:

GRANT ALL PRIVILEGES ON *.* TO 'administrator'@'localhost' IDENTIFIED BY 'very_strong_password';

Conclusion #

We’ve got proven you how one can set up MySQL on Ubuntu 20.04. Now that your database server is up and working, the next step may very well be to learn to handle MySQL person accounts and databases

We hope the How to Install MySQL on Ubuntu 20.04 help you. If you have any query regarding How to Install MySQL on Ubuntu 20.04 drop a comment below and we will get back to you at the earliest.

We hope this post helped you to find out  How to Install MySQL on Ubuntu 20.04  . You may also want to see – how to Install MongoDB on Debian 10

Copy link
Powered by Social Snap