A quick guide to install MySQL server on Ubuntu Linux

posted in: Database, MySql | 1

Hi everybody!  This article will quickly show you how to install both MySql server and client on machines running Ubuntu Linux.

In order to perform this operation you should first of all make sure that the system package index is up to date by issuing the following command in your terminal.

As a second step you have to install the server and client of MySQL, you can install them at the same time using one-liner command by running the following command from the terminal:

Cool that’s easy !

Usually after the installation, Ubuntu starts MySQL automatically. To check that, you have several ways, but I really prefer the one by checking the service status using this command.

or this geekiest way by checking for open ports using netstat command.  (You should know that MySQL uses tcp port 3306 by default)

Something wrong, Mysql doesn’t start ?

If MySQL service doesn’t start, you can start it manually by typing the following command.

or this one :

Now it’s time to login to MySQL server using the client, but before doing that we should know that MySQL comes with no root password as default, you should think about security !!!
You can set a new root password by following this command.

Nice ! Let’s finally log in to MySQL.

If you want to enable MySQL to start at boot use chkconfig command to enable mysql service during boot time (chkconfig must be installed before)

To disable MySQL from starting during boot time.

Have fun!  I’m looking forward to your feedback and questions.

  1. Ghassen Telmoudi

    I believe it’s highly recommended to set the password of MySQL admin which is root on Ubuntu, while asked on the installation wizard.

Leave a Reply

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