Difference between revisions of "MariaDB"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
 
(46 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[wikipedia:MariaDB]]
 
[[wikipedia:MariaDB]]
  
MariaDB is at least supported in [[AWS]], [[Azure]] and [[Alibaba]].
+
MariaDB is at least offered as a service in [[AWS RDS]] (2015), [[Azure]] and [[Alibaba]] cloud providers.
  
 +
== Installation ==
 +
* <code>[[apt install mariadb-common]]</code>
 +
* <code>[[apt install mariadb-server]]</code>
 +
* <code>[[brew install mariadb]]</code>
 +
 +
Helm by [[Bitnami]]
 +
[[helm repo add]] bitnami https://charts.bitnami.com/bitnami && [[helm install my-mariadb bitnami/mariadb]]
  
 
== Configuration files ==
 
== Configuration files ==
 
* Ubuntu:  <code>[[/etc/mysql/mariadb.conf.d/50-server.cnf]]</code>
 
* Ubuntu:  <code>[[/etc/mysql/mariadb.conf.d/50-server.cnf]]</code>
* Data: <code>[[/var/lib/]]mysql/</code>
+
* Data: <code>[[/var/lib/mysql/]]</code>
  
 
== Binaries ==
 
== Binaries ==
Line 14: Line 21:
  
 
== Logs ==
 
== Logs ==
* <code>/var/log/mysql/[[error.log (MariaDB)|error.log]]</code>
+
* <code>[[/var/log/mysql/error.log]]</code>
  
* <code>show variables</code>
+
* <code>[[show variables]]</code>
 
** <code>SHOW VARIABLES LIKE 'maria_group_commit';</code>
 
** <code>SHOW VARIABLES LIKE 'maria_group_commit';</code>
  
 
== Activities ==
 
== Activities ==
# Perform the following tasks:<ref>[https://www.redhat.com/en/services/training/ex300-red-hat-certified-engineer-rhce-exam RedHat RHCE certification objectives]</ref>
+
* Perform the following tasks: (from retired [[RHCE]] certification)<ref>[https://www.redhat.com/en/services/training/ex300-red-hat-certified-engineer-rhce-exam RedHat RHCE certification objectives]</ref>
#* Install MariaDB. For example in MacOS: <code>[[brew]] install mariadb</code>
+
** [[Install MariaDB]]. For example in MacOS: <code>[[brew install mariadb]]</code>
#* Start and configure MariaDB.  
+
** Start and configure MariaDB.  
#* Backup and restore a database
+
** Backup and restore a database (<code>[[mariabackup]]</code>)
#* Create a simple database schema
+
** Create a simple database [[schema]]
#* Perform simple [[SQL]] queries against a database
+
** Perform simple [[SQL]] queries against a database: <code>[[select]]</code>
#* Create a basic table
+
** Create a basic table: <code>[[create table]]</code>
 +
 
 +
* Activate [[MariaDB slow queries]] log
 +
* Verify your database with <code>[[mariadb-check]]</code> command
  
 
== Install and start MariaDB in MacOS ==
 
== Install and start MariaDB in MacOS ==
Line 45: Line 55:
  
 
== Docker installation ==
 
== Docker installation ==
[[docker run]] --name some-mariadb [[-v]] /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:latest
+
* https://hub.docker.com/_/mariadb
 +
*<code> [[docker run]] [[--name]] some-mariadb [[-v]] /my/own/datadir:[[/var/lib/mysql]] [[-e]] MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:latest</code>
  
=== Create a table: CREATE TABLE ===
+
== Create a table: CREATE TABLE ==
 
* [[Connect to database]] test, will be created in default MariaDB installation:  
 
* [[Connect to database]] test, will be created in default MariaDB installation:  
 
:<code>mysql test</code>
 
:<code>mysql test</code>
 
* Create a basic table with two columns using the <code>create table</code> <ref>https://www.w3schools.com/sql/sql_create_table.asp</ref><ref>https://mariadb.com/kb/en/library/create-table/</ref> SQL statement:  
 
* Create a basic table with two columns using the <code>create table</code> <ref>https://www.w3schools.com/sql/sql_create_table.asp</ref><ref>https://mariadb.com/kb/en/library/create-table/</ref> SQL statement:  
:<code>create table my_first_table (my_first_column char, my_second_column char);</code>
+
:<code>[[create table]] my_first_table (my_first_column char, my_second_column char);</code>
* Show tables so we can check our new created table is available:
+
* [[Show tables]] so we can check our new created table is available:
 
<pre>
 
<pre>
 
MariaDB [test]> describe my_first_table;
 
MariaDB [test]> describe my_first_table;
Line 73: Line 84:
 
</pre>
 
</pre>
  
# Show privileges: <code>MariaDB [(none)]> show grants;</code>
+
# Show privileges: <code>MariaDB [(none)]> [[show grants]];</code>
 
# Allow remote root access: <code>GRANT ALL PRIVILEGES on *.* to 'root'@'%' IDENTIFIED BY 'YOUR_PASSWORD';</code>
 
# Allow remote root access: <code>GRANT ALL PRIVILEGES on *.* to 'root'@'%' IDENTIFIED BY 'YOUR_PASSWORD';</code>
  
 
== Commands ==
 
== Commands ==
 
* <code>[[show engines]]</code>
 
* <code>[[show engines]]</code>
 +
* <code>[[show tables]]</code>
 +
* <code>[[FLUSH STATUS;]]</code>
  
 
== Advanced Features ==
 
== Advanced Features ==
* Understand MariaDB [[wikipedia:partitioning]] (w:https://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems#Partitioning)  and uses cases<ref>https://mariadb.com/kb/en/library/partitioning-overview/</ref>. <code>SHOW PLUGINS</code> to see if your version support it.
+
* Understand MariaDB [[wikipedia:partitioning]] (w:https://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems#Partitioning)  and uses cases<ref>https://mariadb.com/kb/en/library/partitioning-overview/</ref>. <code>[[SHOW PLUGINS]]</code> to see if your version support it.
 
* Create a MariaDB Cluster using MariaDB [[Galera Cluster]]. <ref>https://mariadb.com/kb/en/library/what-is-mariadb-galera-cluster/</ref>
 
* Create a MariaDB Cluster using MariaDB [[Galera Cluster]]. <ref>https://mariadb.com/kb/en/library/what-is-mariadb-galera-cluster/</ref>
* [[Tunning]] you Limitating variables like: <code>max_connections</code>
+
* [[Tunning]] you limitating variables like: <code>[[max_connections]]</code>
 +
* [[MariaDB replication]]
  
 
== Related terms ==
 
== Related terms ==
 
* [[Percona]]
 
* [[Percona]]
 
* [[SkySQL]]
 
* [[SkySQL]]
* [[Remote working]]
+
* [[MariaDB Foundation]]
 +
* [[HA]]: [[Replication]]
 +
* https://github.com/major/MySQLTuner-perl/blob/master/INTERNALS.md
 +
* <code>[[Adminer]]</code>
  
 
== Activities ==
 
== Activities ==
 
# Understand how to limit the number of [[threads]] to save memory for the database [[memory buffers]]: https://mariadb.com/kb/en/library/thread-pool-in-mariadb/
 
# Understand how to limit the number of [[threads]] to save memory for the database [[memory buffers]]: https://mariadb.com/kb/en/library/thread-pool-in-mariadb/
:<code>SHOW VARIABLES LIKE 'thread_handling';</code>
+
:<code>[[SHOW VARIABLES]] LIKE 'thread_handling';</code>
 
<pre>
 
<pre>
 
MariaDB [(none)]> SHOW VARIABLES LIKE 'thread_handling';
 
MariaDB [(none)]> SHOW VARIABLES LIKE 'thread_handling';
Line 103: Line 120:
 
thread_handling = [ pool-of-threads | one-thread-per-connection ]
 
thread_handling = [ pool-of-threads | one-thread-per-connection ]
  
# Read [[MariaDB Changelog]]
+
# Read [[MariaDB Changelog]]/releases
 +
# Read [[MariaDB]] [[encryption]] capabilites https://mariadb.com/kb/en/data-at-rest-encryption-overview/
  
 
== See also ==
 
== See also ==
 
* [[MyRocks]]
 
* [[MyRocks]]
* {{DBs}}
+
* {{Database management}}
 
* {{MariaDB}}
 
* {{MariaDB}}
  

Latest revision as of 18:00, 21 June 2024

wikipedia:MariaDB

MariaDB is at least offered as a service in AWS RDS (2015), Azure and Alibaba cloud providers.

Installation[edit]

Helm by Bitnami

helm repo add bitnami https://charts.bitnami.com/bitnami && helm install my-mariadb bitnami/mariadb

Configuration files[edit]

Binaries[edit]

Logs[edit]

Activities[edit]

Install and start MariaDB in MacOS[edit]

  • brew install mariadb
  • Start MariaDB:
/usr/local/bin/mysql.server start (command is mysql but you are actually starting MariaDB)
Starting MariaDB
.180619 10:15:19 mysqld_safe Logging to '/usr/local/var/mysql/file.err'.
180619 10:15:19 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
 SUCCESS! 
  • Check MariaDB is running: /usr/local/bin/mysql.server status
 SUCCESS! MariaDB running (80662)


Docker installation[edit]

Create a table: CREATE TABLE[edit]

mysql test
  • Create a basic table with two columns using the create table [2][3] SQL statement:
create table my_first_table (my_first_column char, my_second_column char);
  • Show tables so we can check our new created table is available:
MariaDB [test]> describe my_first_table;
+------------------+
| Tables_in_test   |
+------------------+
| my_first_table   |
+------------------+
  • Show details about your new table:
MariaDB [test]> describe my_first_table;
+------------------+---------+------+-----+---------+-------+
| Field            | Type    | Null | Key | Default | Extra |
+------------------+---------+------+-----+---------+-------+
| my_first_column  | char(1) | YES  |     | NULL    |       |
| my_second_column | char(1) | YES  |     | NULL    |       |
+------------------+---------+------+-----+---------+-------+
2 rows in set (0.003 sec)
  1. Show privileges: MariaDB [(none)]> show grants;
  2. Allow remote root access: GRANT ALL PRIVILEGES on *.* to 'root'@'%' IDENTIFIED BY 'YOUR_PASSWORD';

Commands[edit]

Advanced Features[edit]

Related terms[edit]

Activities[edit]

  1. Understand how to limit the number of threads to save memory for the database memory buffers: https://mariadb.com/kb/en/library/thread-pool-in-mariadb/
SHOW VARIABLES LIKE 'thread_handling';
MariaDB [(none)]> SHOW VARIABLES LIKE 'thread_handling';
+-----------------+---------------------------+
| Variable_name   | Value                     |
+-----------------+---------------------------+
| thread_handling | one-thread-per-connection |
+-----------------+---------------------------+
1 row in set (0.00 sec)

thread_handling = [ pool-of-threads | one-thread-per-connection ]

  1. Read MariaDB Changelog/releases
  2. Read MariaDB encryption capabilites https://mariadb.com/kb/en/data-at-rest-encryption-overview/

See also[edit]

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Original Source: https://en.wikiversity.org/wiki/MariaDB

Advertising: