How to install MySQL in Ubuntu 14

To install MySQL in Ubuntu, need to have root access to an Ubuntu server. This tutorial applies either to a dedicated server and a cheap vps hosting server. The first step is to login by SSH into your server.

First of all, we have to update all the packages of the server

Now we will install MySQL in Ubuntu

During the MySQL installation uou will be prompted for the MySQL root password. Write it down and keep it in a safe place.

install mysql in ubuntu 1

If you forget the MySQL root password, you can read this article: how to recover MySQL root password in Ubuntu

Now that the installation is completed, MySQL will start listening only for internal connections in localhost on port 3306. As you install mysql in ubuntu, the remote connections will be blocked.

Managing the MySQL server

Having the installation completed, we can now login to the MySQL server:

You will see this output:

Managing the installed MySQL server

First, we will create a new database.

Now we will create a new user. You must replace [password] with the desired password for it.

Give access privileges to the user to the new database:

Now exit mysql, and access with the newly created user:

To access with the new user, just issue the command:

Creating a MySQL table

To create a new table in our recently created database, we must first issue the command use <database_name> , and then, issue the Create table command:

Now the table is created.

Some useful comands, are show tables and describe. Show tables will show you all the created tables in the server, and describe will show in details all the fields of a certain table.

Keep in mind that by completing the install MySQL in ubuntu task, it will block external connections. You can only connect to your database server from inside your server, unless you enable the remote connections.

 

Leave a Reply

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