How To Install MySQL 5.7 Community on Ubuntu



MySQL, the most popular Open Source SQL database management system developed, distributed, and supported by Oracle Corporation.

In this article we’ll go over the steps to install MySQL Server on your Ubuntu environment.

  1. Installed MySQ 5.7  packages
  • First download APT package repository with command below
  • Next, installed the .deb package previously downloaded with this command
in the prompt below select MySQL Server (mysql-5.7) and press Enter

  • The next step is to update your package index
  • Now we can installed MySQL Server Community with command below

During the installation you will be asked to provide a password for root userID, type a secure one and make sure you remember it, because you’ll need it later.


II. Secure MySQL after Installation and initialize


This program enables you to improve the security of your MySQL installation in the following ways:
– You can set a password for root accounts.
–  You can remove root accounts that are accessible from outside the local host.
– You can remove anonymous-user accounts.
– You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.


The next step is to initialize your MySQL with command below :


To test your MySQL service you can run below commands


you can also replace status with stop, start or restart  to stop start or restart your service regardless of your situation.

to connect to your MySQL instance on CLI (command line Mode) run below command:


and you will be prompt to enter the root password your previously set (:

Author: Mikael HOUNDEGNON

My name is Mikael HOUNDEGNON. I am an experienced MySQL DBA/Developer based in the greater Chicago area. You can find out more about me here. I blog here mostly about things I don’t want to forget ? most likely, MySQL Tips. My specialties : MySQL Replication (Master Slave, MultiMaster, Fail over, etc) MySQL Backups MySQL Query Optimization MySQL Performance Tuning MySQL Stored Procedures Storage Engine Tuning Do you have an interesting project idea? Or you just want to chat? Get in touch!

One comment

Leave a Reply

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