## How to run MariaDB?

Once you install MariaDB then decide its current state before run MariaDB whether it is running or shutdown. You can use following ways for starting and stopping MariaDB −
• Run mysqld (the MariaDB binary).
• Run the mysqld_safe startup script.
• Run the mysql.server startup script.
If you installed MariaDB in a non-standard location, you may have to edit location information in the script files. You can stop MariaDB by adding a “stop” parameter with the script.
Simply add startup scripts to your init system to start it automatically under Linux, add startup scripts to your init system. Go through system distribution documentation to know more.

## Creating a User Account

Create a new user account with the following code –
This code adds a row to the user table with no privileges. You also have the option to use a hash value for the password. Grant the user privileges with the following code –
Many commands are available in MariaDB. After creating a user, execute a “FLUSH PRIVILEGES” command in order to refresh grant tables. This allows the user account to be used.

## The Configuration File

After a build on Unix/Linux, the configuration file “/etc/my.conf” should be modified to appear as follow –
# Example mysql config file.
# You can copy this to one of:
# /etc/my.cnf to set global options,
# /mysql-data-dir/my.cnf to get server specific options or
# ~/my.cnf for user specific options.
#
# One can use all long options that the program supports.
# Run the program with --help to get a list of available options
# This will be passed to all mysql clients
[client]
#port = 3306
#socket = /tmp/mysql.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# The MySQL server
[mysqld]
#port = 3306
#socket = /tmp/mysql.sock
temp-pool
# The following three entries caused mysqld 10.0.1-MariaDB (and possibly other
versions) to abort...
# skip-locking
# set-variable = key_buffer = 16M
# set-variable = thread_cache = 4
loose-innodb_data_file_path = ibdata1:1000M
gdb
######### Fix the two following paths
# Where you want to have your database
data = /path/to/data/dir
# Where you have your mysql/MariaDB source + sql/share/english
language = /path/to/src/dir/sql/share/english
[mysqldump]
quick
8
set-variable = max_allowed_packet=16M
[mysql]
no-auto-rehash
[myisamchk]
set-variable = key_buffer = 128M
Edit the lines "data= " and "language= " to match your environment.
After file modification, navigate to the source directory and execute the following –
Omit the “$PWD” variable if you added datadir to the configuration file. Ensure “$LOGNAME” is used when running version 10.0.1 of MariaDB.

Here are some important commands you come across when working with MariaDB −
• USE [database name] − Sets the current default database.
• SHOW DATABASES − Lists the databases currently on the server.
• SHOW TABLES − Lists all non-temporary tables.
• SHOW COLUMNS FROM [table name] − Provides column information pertaining to the specified table.
• SHOW INDEX FROM TABLENAME [table name] − Provides table index information relating to the specified table.
• SHOW TABLE STATUS LIKE [table name]\G – − Provides tables with information about non-temporary tables, and the pattern that appears after the LIKE clause is used to fetch table names.