Check out example codes for "ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)". It will help you in understanding the concepts better.

Code Example 1

# This is usually caused by the fact that the
# MySQL Server isn't even running
# On Windows, check your services, if its not running
# start it, or install and start it.

# On *nix, for this example Debian based
# Firstly see if it's even running
ps aux | grep mysql

# If you dont see any process other than your grep call,
# It's not running

# Assuming you have mysql-server installed
# Start it
sudo /etc/init.d/mysql start

# Otherwise install it, configure and start it up as above
sudo apt-get install mysql-server

# Goodbye 2002

Learn ReactJs, React Native from