Totorial Basic Common Query in MariaDB and MySQL

33 views

MariaDB and MySQL are most popular an open-source database management system, commonly installed as part of the popular LAMP/NGINX, a relationship database and SQL (Structured Query Language) to manage its Databases are a key component many websites and applications core of how data is stored and exchanged

There are several ways to retrieve data from a database, one of the most commonly-used through submitting queries on the command line. here is Basic tutorial common query in MariaDB and MySQL.


1. Creating a Sample Database

To begin, open up a MySQL prompt as your root MySQL user:

sudo mysql

If you followed the prerequisite the tutorial on Installing MySQL on Ubuntu 18.04, you may have configured your root user to authenticate using a password. In this case, you will connect to the MySQL prompt with the following command:

mysql -u root -p

Next, create the database by running:

CREATE DATABASE `birthdays`;

Then select this database by typing

USE birthdays;

 

+---------+------------+
| name    | birthdate  |
+---------+------------+
| Dolly   | 1946-01-19 |
| Etta    | 1938-01-25 |
| Irma    | 1941-02-18 |
| Barbara | 1948-12-25 |
| Gladys  | 1944-05-28 |
+---------+------------+
5 rows in set (0.00 sec)