Posts

Showing posts from March, 2020

Basic MySQL/MariaDB

This post is about setting up MariaDB in Linux. I am using CentOS 7.

1. Install MariaDB

# sudo yum install mariadb-server
2. Enable and start MariaDB

# sudo systemctl enable mariadb # sudo systemctl start mariadb
3. Use MariaDB

# mysql

For my project, I am preparing a YouTube database, based on a dataseet that I got from Internet. Somehow, this page is no longer available, but I have made a copy of it in my github repository.

At the MariaDB CLI, I created a database called "yt_data" with a DB user that has all privilege to this database.

MariaDB [(none)]> create database yt_data; MariaDB [(none)]> grant all privileges on yt_data.* to 'db_user'@'localhost' identified by 'db_pass'; MariaDB [(none)]> flush privileges;
In order to login to MariaDB with the user account I created to access to the database that I created, here's the command line.

# mysql -u db_user -p yt_data

Note, by default, MariaDB can be accessed without any credential. You…

NoSQL v SQL Part 1 - resource usage comparison

To skip my ranting, go to the actual topic, click here. Or you would like to jump to the summary directly.

Recently I kept getting advertisement on migrating your SQL database to NoSQL. It's been 5 years since I last deal with database related work, excluding the CRUD on database task. NoSQL was quite new to me then, our platform main database backbone was Oracle DB. I am still not sure how or why we were convinced to have a new subsystem to use MongoDB, but that's the strength of developers, creating a good looking resume profile, and new task opportunities in the company. (I don't say new job opportunities, as we don't hire new DBA to support NoSQL. I forgot, and could be I was not informed, if the DBAs were sent for training to support this. :D)

Based on my past experience and study, NoSQL was for a totally different use case. It is for non-structured database, simple design, and ...??

I just did a quick check on my profile, the my M101P: MongoDB for developers cert…

Basic MongoDB

This post is about setting up MongoDB in Linux. I am using CentOS 7.

1. Adding the mongoDB repository

> vi /etc/yum.repos.d/mongodb.repo

[MongoDB]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

2. Install MongoDB

> yum install mongodb-org

3. Starting MongoDB service

> systemctl start mongod.service

4. Use the MongoDB

> mongo

Voila, you can start to use MongoDB right away.

For my project, I am preparing a YouTube database, based on a dataset that I got from YouTube 2 data set.

At the mongo shell, I am creating a database called "yt_data" with a DB user that is granted with readwrite access only to this database.

> use yt_data > db.createUser( { user: "db_user", pwd: "db_pass", roles: [{ role: "readWrite", db: "yt_data"}] }); Successfully added user: { "user" : "db_user&q…

Working with github repository

It's been more than 5 years, I don't really work on any programming project. All my git/perl knowledge are gone. I was stunt a bit when looking back my documentation at Basic commands of git.

I have cleaned up my github account, and start new repository to host the files and scripts on a database related research that I am working on. Spent some time to read some more git commands online, and the instruction on github, finally I manage to link my local repository with the github repository that I created. It took me quite sometime to get things right. :(

Here's the step.

1. Create a github repository.

2. Create a local git repository.
> git init

3. Add the github repository as our origin
> git remote add origin https://github.com/<your github repository>

4. Clone the github repository to local (If you have files in the github repository already)
> git clone https://github.com/<your github repository>

5. Create a branch in local
> git checkout -b &l…