Home » Android » How To Install MariaDB MySQL Server In Termux Android?

MariaDB Server

How To Install MariaDB MySQL Server In Termux Android?

Poated on by

Categories Android Termux Web Development

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?

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.

Pre Requirements:

  • 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

Or

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.

mysqld_safe &

After running this mysql daemon the server will be started and we can access the mysql server my running mysql command.

MariaDB Server
Start MariaDB Server

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
Login To MySQL

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:

USE mysql;

SET PASSWORD FOR 'root'@'localhost' PASSWORD('easymux@mysql');

FLUSH PRIVILEGES;
Set MySQL root Password

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.

QUIT;

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.

MySQL Login With Password

Usefull MariaDB Commands

Start MariaDB Server

mysqld_safe &

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

select user();
Show Current User

List Databases

show databases;
Show Databases

Create New Database

create database easymux;
Create Database

Select Database to Work With

use easymux;
Use Database

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));
Create Table

List Tables of Database

USE easymux;
SHOW TABLES;
Show Tables

See The Structure Of Table

DESCRIBE tbl_user;
Describe 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';
Tags: , ,

3 Comments on 'How To Install MariaDB MySQL Server In Termux Android?'

  • Amit says:

    I try many tutorials but this one is #1

    pkg update && pkg upgrade
    pkg install mariadb
    mysqld_safe &
    mysql -u root

    Done! Greate blog keep up

  • Diya Dutta says:

    Thank you. This is very helpful for me. ❤❤

  • on line pharmacy says:

    Hey There. I found your blog using msn. This is a really well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely comeback.


  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    Search
    Subscribe Us