If you are still stucked in installation of MySQL (MariaDB) on your android — don’t worry we have a quick and best solution for that.
We have already done a tutorial on this topic : How to Install MySQL (MariaDB) on Android With Termux But this tutorial on how to install mysql is going to be far more easy and straightforward than our old tutorial.
We made a simple tool (bash scripting) to solve this problem, which automates all the processes and you only need to use some easy instructions commands.
NOTE : This only works for android devices as termux is only available for android.
Installation
-
Install Termux App (Click Here)
-
Open Termux Application
-
Copy & Paste The Below Command :
apt update && apt upgrade; pkg install wget; cd ..; wget -O mysql.tar.gz "https://github.com/sumit-buddy/mysql-for-termux-android/archive/v1.0.tar.gz"; tar -xzf mysql.tar.gz -C home --strip-components 1 && rm mysql.tar.gz && cd home && rm -r images && rm README.md; chmod u+x installer.sh; ./installer.sh; source ~/../usr/etc/bash.bashrc; rm installer.sh
-
Now the installation will begin. (Please be patient as this may take some time depending on your internet speed)
-
You will be asked to answer
Do you want to continue? [Y/n]
upto three times. Each time type in ‘y’ and press enter. -
After that, the following pop-up will appear. You can simply allow because this app does not consume much battery at all :
- When the entire installation process is completed, a text saying “MySQL installed successfully” should appear. Now, the MySQL server has started on your machine and you are all set to use MySQL.
Commands
- start-server
start-server
Run this command to start MySQL server. (First time during installation the server starts by default, so no need to run there)
- setpass
setpass
Use this command to set a password for the user. (This can only be done while the server is running.)
- start-client
start-client
Run this command to start the MySQL client.
- stop-server
stop-server
Use this command to stop MySQL server (daemon).
Must use this command to stop MySQL server after exiting mariadb, otherwise when you try to start the server again you will get the error : Error 2002 (HY000)
Troubleshooting Errors
- If you get any errors during or after installation, you can check the log file using the command:
cat logs.log
- If you get the following error — use the command
stop-server
and then restart usingstart-server
command :
Error 2002 (HY000): Can't connect to local MySQL server through the socket '/data/data/com.termux/files/usr/tmp/mysqld.sock' (111)
If you’re still finding it difficult or having some error, you can send a screenshot of your error and ask for help…