Check out example codes for "can't connect to local mysql server through socket '/tmp/mysql.sock' (2)". It will help you in understanding the concepts better.

Code Example 1

Try to start the MySQL server:
mysql.server start

Learn ReactJs, React Native from akashmittal.com