Termux-packages: MariaDB [MySQL]: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/data/com.termux/files/usr/tmp/mysqld.sock' (2)

Created on 3 May 2019  路  7Comments  路  Source: termux/termux-packages

Everytime I execute mysql this error always pop up (
Errror 2002 (HY000): Can't connect to local MySQL server through socket '/data/data/com.termux/files/usr/tmp/mysqld.sock' (2))
I tried using the recommended solution from a github user by creating my.cnf.d directory and executing mysqld_safe_install and mysqld_safe -u root & but still the problem will repeat repeat once I close the terminal. Any work arounds?

Most helpful comment

You haven't started mysql server. Execute something like


and only then try mysql.

All 7 comments

You haven't started mysql server. Execute something like


and only then try mysql.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/data/com.termux/files/usr/tmp/mysqld.sock' (2)
Same problem here please help

@rawagent09 Ensure that server is running before trying to connect ;)

You haven't started mysql server. Execute something like


and only then try mysql.

In New Session mysqld_safe
Then try in first session mysql

You haven't started mysql server. Execute something like


and only then try mysql.

but do we need to execute each time

iam on remux

but do we need to execute each time

Before using client, you need to ensure that server is running, right? If mysqld_safe is not running, then you need to start it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

newmania picture newmania  路  3Comments

ILadis picture ILadis  路  3Comments

Zuccace picture Zuccace  路  3Comments

reggi picture reggi  路  4Comments

divyakutty picture divyakutty  路  3Comments