Termux Tutorial: How To Install MySQL on Android

Termux Tutorial: How To Install MySQL on Android

What is Termux?

Setup MySQL in termux


Termux is an Android terminal emulator and Linux environment which allows users to run Linux packages and commands on their Android devices. It gives Linux-like environment on Android, and thus users can install and execute different command-line tools and programs. It is so powerful I cannot enumerate all the things it allows you to do with your device. For now, let’s just leave it at that it will help you when you do not have a computer.


$ads={1}

Step 1 Termux Installation


Get the app from the official website or from f-droid. You can also get it from the Play Store but this one has not been updated for a long time.

Step 2: setup Termux


Open Termux and then type the following command: 

pkg update-all.

If asked to continue then type “y” and hit enter. If prompted while still updating just press enter (you might have to do it more than once). After the update is done, copy-paste and run (press enter) this command:

pkg upgrade && pkg in git python


pkg upgrade && pkg in git python -y && cd 


Then copy and paste the MySQL installation command below:



git clone https://github.com/anay-p/mysql-for-termux.git && cd mysql-for-termux && python installer.py && source ~/../../usr/etc/bash.bashrc

It will install what is required for this tutorial and you will be inside mysql-for-termux folder and the SQL server will be started. Press ls and the enter. There you will find the files necessary for MySQL in this directory. I will explain their functionality below.

  • setpass.sh — This will allow you to set up a password for your SQL connection.
  • ./start-server.sh — This launches SQL server so that we can begin using SQL.
  • start-client.sh — This initiates the MariaDB “client” where we can write our SQL statements.

$ads={2}

To run either of these files now you have to type ./ before the names and then press enter. For example, to start the start-client.sh script we’d have to type ./start-client.sh and press the Enter.
./start-client.sh

When you run this command it would ask for a password proceed to press Enter and it will start MariaDB “interface”. You can write your SQL queries in now. To set a password run the setpass.sh script. When Termux is closed, the server can also close, therefore when starting the client it is necessary to start the server first. More Termux Tutorials below. You can also check out our YouTube playlist here.

If you would like to get more of my posts on Termux, linux and programming in general please follow on WhatsApp or YouTube. Never miss out on future posts on Tech Tutorials Hub by «following us on WhatsApp» or Download our App

Thanks for reading, we would love to know if this was helpful. Don't forget to share!

Post a Comment (0)
Previous Post Next Post