MySQL Error 2003 (HY000): Can't connect to MySQL server on '172.0.0.1' (10060) code example
Example 1: ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
# 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
Example 2: docker ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)
# This seems to work... Your milage may vary...
% docker run --rm -d -e MYSQL_ROOT_PASSWORD=pass -p 3325:3306 --name mysql_test mysql:5.7
% mysql -uroot -ppass -h127.0.0.1 -P3325