When you start web development MySQL is must have database. Since its free and is being used widely. Installing MySQL on Ubuntu is pretty easy and quick process. To install MySQL just run the following command.

Open a terminal window and type the following command.

sudo apt-get install mysql-server

It will ask for Y/n, press Y and allow the installer to install MySQL server. Yes, that is all you need to do for installing MySQL server on your Ubuntu box. Now next comes integrating it with PHP. To add PHP’s MySQL support, run the following command in the terminal.

sudo apt-get install php5-mysql

You are all done to run MySQL with PHP. Let us now create a database to get you started.

mysqladmin create test_database

You can replace the “test_database” with whatever name you want to. Next is to connect to MySQL database through command line, type the following command.

mysql –h localhost –u root –p

This will open MySQL prompt for root user which has blank password by default.

Note: You can also create database from inside the MySQL prompt, if you have not create the database as stated above, you create as follows:

create database test_database;

To select the database which we just created, type the following command inside the mysql prompt.

use test_database;

Now you have select the test_database, go ahead and create your tables and enjoy.

Stay Digified !!
Sachin Khosla

Share this post: