Connecting to MariaDB Server on Termux Android

DeenOub picture DeenOub · Jul 26, 2018 · Viewed 10.1k times · Source

I'm working on launching a NodeJS project directly on a local database on an Android Device and for this I use Termux and MariaDB Server.

It perfectly works after using the commands

mysqld & 

and

node mynodefile.js

on Termux. But I would like to avoid the "mysqld &" command and launch the MariaDB Server in another way. So I downloaded the MariaDB Server App for Android. But even if I launch the server with it, Termux doesn't even detect the new process and I can't access to mysql. It gives me the following error:

$ mysql -u root -p -h127.0.0.1
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/data/com.termux/files/usr/var/lib/mysqld.sock' (111)

It seems that the server is still off... Do you have any idea to resolve my problem ?

Thank you.

Answer

Bola Ibrahim picture Bola Ibrahim · Sep 23, 2018

try

$mysql_install_db

$mysqld

then

$mysql -u root -p