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.
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.
It is now possible to install MariaDB MySQL Server on Android through Termux App.
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.
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.
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.
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;
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.
mysqld_safe &
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.
select user();
show databases;
create database easymux;
use easymux;
CREATE TABLE IF NOT EXISTS tbl_user (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ussrname VARCHAR(20), password VARCHAR(32));
USE easymux;
SHOW TABLES;
DESCRIBE tbl_user;
INSERT INTO tbl_user VALUSES(null,'easymux','mypassword');
UPFATE TABLE tbl_user SET password = 'newpassword' WHERE id = '2';
DELETE FROM tbl_user WHERE id = '1';