• Home
  • DBA Scripts
    • Oracle Scripts
    • SQL Server Scripts
  • Knowledge Base
    • Oracle Database
    • MS SQL Server
    • MongoDB
    • MariaDB
  • Troubleshoot
    • Oracle Database Issues
    • SQL Server Issues
  • Interview Questions
    • AWS Interview Questions
    • Oracle DBA Interview Questions
    • SQL Server Interview Questions
  • Courses
    • Oracle Database
    • Oracle DBA L1
    • Oracle DBA L2
    • Oracle DBA L3
  • Home
  • DBA Scripts
    • Oracle Scripts
    • SQL Server Scripts
  • Knowledge Base
    • Oracle Database
    • MS SQL Server
    • MongoDB
    • MariaDB
  • Troubleshoot
    • Oracle Database Issues
    • SQL Server Issues
  • Interview Questions
    • AWS Interview Questions
    • Oracle DBA Interview Questions
    • SQL Server Interview Questions
  • Courses
    • Oracle Database
    • Oracle DBA L1
    • Oracle DBA L2
    • Oracle DBA L3
home/Knowledge Base/MariaDB/MariaDB Administration
Popular Search:Oracle, SQL Server, MongoDB

MariaDB Administration

361 views 0 June 1, 2020 admin

Before attempting to run MariaDB, first determine its current state, running or shutdown.

There are three options 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. Stop MariaDB by simply adding a “stop” parameter with the script.

If you would like to start it automatically under Linux, add startup scripts to your init system. Each distribution has a different procedure. Refer to your system documentation.

Creating a User Account

Create a new user account with the following code:

'newusername'@'localhost' IDENTIFIED BY 'userpassword';

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:

GRANT SELECT, INSERT, UPDATE, DELETE ON database1 TO 'newusername'@'localhost';

Other privileges include just about every command or operation possible 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 edited to appear as follows:

# 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]

#password=my_password

#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

loose-mutex-deadlock-detector

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

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:

./scripts/mysql_install_db --srcdir=$PWD --datadir=/path/to/data/dir -- user=$LOGNAME

Omit the “$PWD” variable if you added datadir to the configuration file. Ensure “$LOGNAME” is used when running version 10.0.1 of MariaDB.

Administration Commands

Review the following list of important commands you will regularly use 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.

Was this helpful?

Yes  No
Related Articles
  • MariaDB – Where Clause
  • MariaDB – Select Query
  • MariaDB – Insert Query
  • MariaDB – Drop Tables
  • MariaDB – Create Tables
  • MariaDB – Data Types
Leave A Comment Cancel reply

MariaDB
  • MariaDB Administration
  • MariaDB – Where Clause
  • MariaDB – Select Query
  • MariaDB – Insert Query
  • MariaDB – Drop Tables
  • MariaDB – Create Tables
View All 14  
Popular Articles
  • Upgrade Oracle Database from 11.2.0.3 to 12.1.0.2
  • Upgrading MariaDB on Windows
  • Oracle DBA Basic Interview Questions Part A
  • Purging Oracle Sysaux Tablespace
  • Client – Server Architecture
KB Categories
  • Oracle Database
    • Oracle RAC
    • Oracle ASM
    • Oracle GoldenGate
    • Oracle Tuning
    • Oracle 11g Database
    • Oracle Database Upgrade
    • Oracle 12c Database
    • ALL KB Oracle
    • Oracle 18c Database
    • Oracle Standby Database
  • MongoDB
  • MS SQL Server
  • MySQL
  • Interview Questions
    • AWS Interview Questions
    • Oracle DBA Interview Questions
    • SQL Server Interview Questions
  • MariaDB
Database Organization

Database Organization (DB ORG) is knowledge base for DBA to learn and execute the fundamental of different databases under one website. DB ORG is a non-profit initiative. ORACLE, MS SQL Server, MongoDB, MariaDB, Couchbase

Join Our Community
  • KnowledgeBase
  • Documentation
  • Troubleshoot
  • FAQ
Information Links
  • About DBOrg
  • Licenses
  • Terms
  • Privacy Policy
Contact Us
    DB ORG - Database Administration,
    Knowledge Base for DBA
    Mail: support@databaseorg.com
    WhatsApp: (+91) 9306440957
    Monday to Friday: EST - 11:30 AM to 06:30 PM (IST - 9:00 PM to 4:00 AM)
  • © 2023 Database Organization - DB ORG. All Rights Reserved.

Popular Search:Oracle, SQL Server, MongoDB

WhatsApp DB Org