MySQL is a powerful database system used to store and manage data. With Termux, you can install MySQL directly on your Android phone and practice creating databases, tables, and running queries without a PC. Below are the installation steps and basic commands to get started.
Installation
Update Termux packages first:
pkg update && pkg upgrade -yInstall MariaDB (a drop-in replacement for MySQL):
pkg install mariadb -yInitialize the database:
mysql_install_dbStart the MySQL server:
mysqld_safe &Login to MySQL:
mysql -u rootBasic Commands
Show all databases:
SHOW DATABASES;Create a new database:
CREATE DATABASE testdb;Use a database:
USE testdb;Create a table:
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50));Insert data into table:
INSERT INTO users (id, name) VALUES (1, 'Achik');View table data:
SELECT * FROM users;Exit MySQL:
EXIT;Stop MySQL server:
mysqladmin -u root shutdownUninstall MariaDB:
pkg uninstall mariadb