sudo apt-get install mysql-server
• MySQL initially only allows connections from the localhost (127.0.0.1). We’ll need to remove that restriction if you wish to make it accessible to everyone on the internet. Open the file /etc/mysql/my.cnf
gksudo gedit /etc/mysql/my.cnf
• Find the line bind-address = 127.0.0.1 and comment it out
...#bind-address = 127.0.0.1...
• MySQL comes with no root password as default. This is a huge security risk. You’ll need to set one. So that the local computer gets root access as well, you’ll need to set a password for that too. The local-machine-name is the name of the computer you’re working on. For more information see here
mysqladmin -u root password your-new-passwordmysqladmin -h local-machine-name -u root -p password your-new-password
sudo /etc/init.d/mysql restart
• Validate the existence of the socket file
find /var/run/mysqld -name *.sock
If it does not exist then create it.