My Issues is that when I am logged in as a normal user on unix server and then try to login as MySQL root. It throws below error but when I am logged in as root to unix server and then try to connect to MySQL command line it allows me. I don't understand why is this happening. and how to resolve it. I want connect to MySQL command line with any normal unix user not root always. -sh-4.2$ mysql -u root -pPASSWORD ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
-sh-4.2$ su Password: [root@hostname]# mysql -u root -pPASSWORD Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 78203 Server version: 5.5.52-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>
SHOW GRANTS FOR root@localhost;