How to Install MySQL In Ubuntu 18.04/20.04

How to Install MySQL In Ubuntu 18.04/20.04

How to Install MySQL in Ubuntu 18.04. In this tutorial, we’ll show you how to install and secure MySQL on a Ubuntu 18.04 System.  
We will also look at with install MySql, how to manage the MySQL services on ubuntu like  Start  MySQL,  Stop MySQL, Enable MySQL. MySQL is the most popular open-source relational database management system. It is fast, easy to use, scalable, and an integral part of the popular LAMPand LEMP stacks.

MySQL server is a SQL complaint server, in other words it is a relational model database server. It is very popular because it is free. It was developed by Sun and moved to Oracle when Oracle acquired Sun. Oracle continued improving it.

New features in MySQL 8.0

  • MySQL replication enhancements
  • Improved security and account management
  • Improved optimizer
  • Atomic Data Definition Statements (Atomic DDL)
  • A new type of backup lock
  • JSON improvements
  • Support for regular expression using International Components for Unicode (ICU).

Install MySQL in Ubuntu

To install MySQL on your Ubuntu server follow the steps below :

First update the apt package

sudo apt-get update

Install the MySQL package on ubuntu with the below command :

sudo apt-get install mysql-server

Secure MySQL Server Installation

Default MySQL is insecure , we need to secure the database server.

After installation is complete, the mysql_secure_installation utility runs.
Run the below command and answer the few questions based on your environment requirements.

sudo mysql_secure_installation

Testing MySQL

MySql installation process is completed, the MySQL service will start automatically. To check MySQL server is running properly, To use this command :

systemctl status mysql.service 

You’ll see output similar to the following :

 mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
   Active: active (running) since Wed 2018-12-20 10:44:25 PDT; 4min ago
 Main PID: 3754 (mysqld)
    Tasks: 28
   Memory: 142.3M
      CPU: 1.994s
   CGroup: /system.slice/mysql.service
           └─3754 /usr/sbin/mysqld

Stop MySql service :

systemctl stop mysql

Start MySql service :

systemctl start mysql

Launch MySQL to Enter Commands

Many MySQL commands can be entered from the MySQL command shell.  This is very similar to a terminal window, but the commands are issued directly to the MySQL service.  From a regular terminal window, enter the following:

sudo mysql –u root –p

The system should prompt for a password, then give an introduction to the MySQL shell.  The command prompt will change to look like this:

mysql>

Conclusion

That’s It! In this article, we have explained how to install MySQL 8.0 in Ubuntu 18.04 .

If you have any questions or thoughts to share, use the comment form below to reach us.

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *