How To Install MariaDB MySQL Server In Termux Android?Poated on by
Now it’s a breeze to install MariaDB MySQL database server, on Termux Android. Follow the step-by-step guide to install most used and most popular RDBMS.
Table of Contents
- What Is MySQL and MariaDB?
- Install MariaDB MySQL Server On Android.
- Usefull MariaDB Commands
What Is MySQL and MariaDB?
Mys’SQL and MariaDB are both most popular open source and frer go use Relational Database Management Systems (RDBMs).
MySQL was originaly developed by Oracle Corporation in 1995 while MariaDB was forked from MySQL in 2009 by a group of MySQL developers under Oracle. The MariaDB is a drop-in replacement for MySQL, and is compatible with most MySQL applications.
In this blog post, we will show you how to install MariaDB MySQL server in Termux Android.
Install MariaDB MySQL Server On Android.
It is now possible to install MariaDB MySQL Server on Android through Termux App.
- A Termux App from Github or F-Droid. Click here to get the App.
- Basic Knowledge of Linux Commands and apt package manager. Click here to learn how to install Linux based Packages in Termux.
Install MariaDB MySQL Server
To install MariaDB MySQL we should update Termux repository. Run the following commnad.
pkg update && pkg upgrade -y
Or you can also use this
pkg upd; pkg upg -y
Now Install MariaDB package.
pkg install mariadb -y
pkg i mariadb -y
This will install MariaDB MySQL Server on Termux Android.
Start MariaDB MySQL Server
To start MariaDB MySQL Server we need to start MySQL Daemon mysqld. You have two commands for this mysqld & mysqld_safe.
Run mysqld_safe in background (&) to start MySQL Daemon. Here is how to do that.
After running this mysql daemon the server will be started and we can access the mysql server my running mysql command.
Use -u option to select username and pass root as Username -p option for Password prompt. By default there is no password set.
mysql -u root
As you can see we are logged in into MySQL Server. Here we can perform various database related tasks lile creating database and tables insert or view data, edit or delete data by executing sql queries;
Here is some important details you need to remember in order to access Databases.
Hostname – localhost:3306
Username – root
Password – no password by default.
Change root Password For MariaDB.
This is all done but if it is not enough and you want to set password for root user then run the following queries:
SET PASSWORD FOR 'root'@'localhost' PASSWORD('easymux@mysql');
If no error occurred congratulations! The password for root user is changed. To check the changes quit MariaDB monitor and try to login with password of root user.
mysql -u root -p
This will prompt password root user to login. Enter the password that you have set before and the MariaDB monitor will be opened.
Usefull MariaDB Commands
Start MariaDB Server
Login To MariaDB root Account
mysql -u root
If password is set
mysql -u root -p
Alright, now you will be logged in into your MariaDB Account. Use following commands and queries as needed.
Display Current User
Create New Database
create database easymux;
Select Database to Work With
Create New Table In Database
CREATE TABLE IF NOT EXISTS tbl_user (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ussrname VARCHAR(20), password VARCHAR(32));
List Tables of Database
See The Structure Of Table
Insert Data To Table
INSERT INTO tbl_user VALUSES(null,'easymux','mypassword');
Update Data From Table
UPFATE TABLE tbl_user SET password = 'newpassword' WHERE id = '2';
Delete Data From Table
DELETE FROM tbl_user WHERE id = '1';