How to install mysql?

First, remove the current version of MySQL you're already using:

$ sudo apt-get purge mysql-client-core-5.5

Now, to install MySQL, run the following command from a terminal prompt:

$ sudo apt-get install mysql-server
$ sudo apt-get install mysql-client

During the installation process you will be prompted to enter a password for the MySQL root user.

Once the installation is complete, the MySQL server should be started automatically. You can run the following command from a terminal prompt to check whether the MySQL server is running:

$sudo netstat -tap | grep mysql

When you run this command, you should see the following line or something similar:

tcp        0      0 localhost.localdomain:mysql           *:* LISTEN -

If the server is not running correctly, you can type the following command to start it:

$ sudo /etc/init.d/mysql restart

You can edit the /etc/mysql/my.cnf file to configure the basic settings: log file, port number, etc.


This command installs the MySQL server, which you need.

sudo apt-get install mysql-server

If you want to run commands from the workbench and not from a terminal, you need the client as well (this is optional):

sudo apt-get install mysql-client

For MySQL Workbench (also optional):

sudo apt-get install mysql-workbench

First you have to remove mysql completely from your system using following commands in terminal

sudo apt-get remove --purge mysql-server mysql-client mysql-common

sudo apt-get update && sudo apt-get upgrade

sudo apt-get autoremove

sudo apt-get autoclean

Now try to reinstall Mysql.