Xampp control panel v2.3.1 I got errors while using -h localhost
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10060)
So, if you installed xampp as is and did not customize any documentroot, serverroot, etc. then the following works :-
start both the services on the xampp control panel click shell enter: # mysql -h 127.0.0.1 -u root
that works just fine. Below is the logtrail:-
# mysql -h 127.0.0.1 -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>