can't connect to mysql server on 'localhost' (10061) cmd 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: error 2003 (hy000) windows 10

1-Click on the Windows 7 start button and type taskmgr in the search bar
2-Right click on the taskmgr program icon and select Run as administrator
3-In the Task Manager window, go to the Services tab
4-Right click on the MySQL service and click Start Service