Install MySQL on Ubuntu

Install MySQL (5.6) on Ubuntu (14.04)

Install MySQL

sudo apt-get install mysql-server-5.6

During the installation system will ask for root user password.

Check the service after installing mysql

sudo netstat -tap | grep mysql

mysql-service-working

If database installed cloud/network or not localhost then you need to change bind address to connect from your pc, to change bind address

nano /etc/mysql/my.cnf

bind-address            = 192.168.0.6

To get effect need restart service

sudo service mysql restart

Now use ssh or MySQL Workbench as client of mysql database.

mysql-connection

Yet, connection error from MySQL Workbench

Failed to Connect to MySQL at xxx.xx.xxx.xxx:3306 with user root

Host ‘xxx.xx.xxx.xxx’ is not allowed to connect to this MySQL server

mysql-connection-error

To resolve this we need to create user and grant privilege to user

CREATE USER 'user'@'XXX.XXX.XXX.XXX' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'XXX.XXX.XXX.XXX' WITH GRANT OPTION;
CREATE USER 'user'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Leave a Reply

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