Summery: This is a MariaDB Tutorial for Beginners.

Earlier we have learned How to install MariaDB on Ubuntu. In this article we are going to discuss some basic MariaDB commands that will help you to get started with using MariaDB. These commands can also be used with MySQL.

Checking the version of your MariaDB Installation

You can check the version of your MariaDB installation using the following command. First log into your Database. Since you’ve just installed MariaDB and you haven’t set a password for the root account, the password will be blank. There for use the following command and hit enter when you are prompt to enter a password.

msql -u root -p

After you logged in you can see your version highlighted in the welcome text.

Checking the version of your MariaDB Installation

How to View Databases in MariaDB

To view all the databases in your MariaDB server run,

show databases;
How to View Databases in MariaDB

How to Creating a New Database in MariaDB

Use the following syntax to create a new database in MariaDB.

create database <yourdatabsename>;
create a new database in MariaDB

How to Use a Database in MariaDB

In order to use a database in MariaDB use the following command,

use <databsename>;
use a database in MariaDB

How to Delete Databases in MariaDB

You can delete a database or table using the following command

drop database <databasename>
Deleting Databases in MariaDB

How to create and view tables in MariaDB

You can use the show tables command to view tables in a database.

View tables in MariaDB

To create a table in database you can use the below syntax.

create table <tablename> (<filedname> <type>)
Creating Tables in MariaDB

You can also use explain statement to get information about a table.

explain <tablename>;
show tables command in MariaDB
Explain tables command in MariaDB

If you find any difficulties when handling MariaDB always look in their Knowledge Base.


0 Comments

Leave a Reply

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