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 LAMP
and 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.
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
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
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
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>
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.
☞ Top 4 Programming Languages to Learn In 2019
☞ Introduction to Functional Programming in Python
☞ Dart Programming Tutorial - Full Course
☞ There Is No Best Programming Language
☞ Learn to Setup Linux Ubuntu 18.04 For Web Development Environment