These are steps I followed during this.
- Install the MySQL server.
- Connect to MySQL server with
- Did ifconfig from my machine to find out my ip-address.
- And then used that ip address to connect to the MySQL server
Then I got the below error.
ERROR 2003 (HY000): Can't connect to MySQL server on 'x.x.x.x' (111)
- The above error comes because of the bind-address of my sql server. In my.cnf file the bind-address of the my sql server has been mentioned and when the my sql server start up it'll bind to that address. By default the address in 127.0.0.1 which is the loop back address, and we can't connect via this address from another machine remotely. The address you specify in bind tells mysql where to listen. 0.0.0.0 is a special address, which means "bind to every available network".
- Then again when i tried to connect using the same command remotely I encountered the below error.
- After a bit of research, the fix in my case was to "GRANT" user root to connect to MySQL on any hosts. By default, user "root" was only allowed to connect to localhost and 127.0.0.1 hosts of MySQL.
#GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '<roots-password>' WITH GRANT OPTION;
Some useful tips:
- Start the my sql server ---> sudo service mysql start
- Stop the my sql server ---> sudo service mysql stop
No comments:
Post a Comment