<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kmhaga</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kmhaga"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Kmhaga"/>
	<updated>2026-04-25T22:19:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=21688</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=21688"/>
		<updated>2022-04-05T10:44:49Z</updated>

		<summary type="html">&lt;p&gt;Kmhaga: /* Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://mariadb.org/ MariaDB] is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. It is notable for being led by the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is the general documentation for normal and common general usage, for professional usage please use [[Production DataBases : mysql]] that is the same as MariaDB but with several modifications focused on production and security!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has dummy counterparts packages for those that are not close to that change from &#039;&#039;mysql&#039;&#039; to &#039;&#039;mariadb&#039;&#039; naming packages.&lt;br /&gt;
&lt;br /&gt;
Take in consideration that the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt; was created during instalation of packages, in the initialization section two users will be created in database init: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;, and in that point only if are in their respective system accounts, will be able to connect to the database service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add mysql mysql-client&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will install the most used ones.. &amp;lt;code&amp;gt;mariadb-cient&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mariadb-server&amp;lt;/code&amp;gt;, rest of packages are brief described here for more information, here are listed in orden of relevance for production server&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MySQL name package !! Since Alpine: !! Brief usage !! Related package&lt;br /&gt;
|-&lt;br /&gt;
| mysql || v2 || it&#039;s a dummy package to easy install of mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| mysql-client || v2 || it&#039;s a dummy package to easy install of commands tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| mariadb || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-client || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-doc || v3.0 || manpages are there! || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-connector-odbc || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-connector-c || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-backup || v3.8 || to external backup devices, not widely used, in past was inside mariadb package || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-server-utils || v3.8 || server commands not widely used, in past was inside mariadb package || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-dev || v3.1 || Need for compilations depends on source code || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-test || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-mytop || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-plugin-rocksdb || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-static || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-embedded || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-embedded-dev || v3.9 ||  use the normal mysql.h and link with libmysqld instead of libmysqlclient || mariadb-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-openrc || v3.8 || separate scripts, in past was embebed on server package || .&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Initialization ==&lt;br /&gt;
&lt;br /&gt;
The alpine package of MySQL/MariaDB are like normal tarball of MySQL one, admins must know what they want.. there&#039;s no automatic window-like installation here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt; must be owned by the mysql user and group. You can modify this behavior but must edit the service file at &amp;lt;code&amp;gt;/etc/init.d&amp;lt;/code&amp;gt; directory. Also, you need to set &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;datadir=&amp;lt;YOUR_DATADIR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; under section &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; at the config file.&lt;br /&gt;
&lt;br /&gt;
# Initialize the main mysql database, and the data dir as standardized to &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt; by the rc script.&amp;lt;br&amp;gt;/etc/init.d/mariadb setup&lt;br /&gt;
# Then you can start the service but there&#039;s no root password set until this point.&amp;lt;br&amp;gt;/etc/init.d/mariadb start&lt;br /&gt;
# Secure the installation by running&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for manage others users and databases&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to finish setup into &#039;&#039;&#039;MariaDB&#039;&#039;&#039; now provide &#039;&#039;&#039;this script called &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; that also are present as &amp;lt;code&amp;gt;mariadb-secure-installation&amp;lt;/code&amp;gt;&#039;&#039;&#039;, too. This script provides minimal and security setup to the database, and here are the questions made explained:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; If you have previously set up a root password, provide it here and press enter, either just push enter. If correctly entered, the response will be &amp;lt;code&amp;gt;OK, successfully used password, moving on...&amp;lt;/code&amp;gt;&lt;br /&gt;
#  &#039;&#039;&#039;Switch to unix_socket authentication [Y/n]&#039;&#039;&#039; Setting the root password or using the Unix_socket ensures that only admins can log into engine database, cos we are not production one just pust &amp;quot;n&amp;quot; to setup a root password, which will give you the response &amp;lt;code&amp;gt;... skipping.&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Change the root password? [Y/n]&#039;&#039;&#039; This gives you the opportunity to change the root password to a stronger one if necessary. So enter &amp;quot;Y&amp;quot; and lest type the new password.. be carefully with that can be remembered.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Answering &#039;Y&#039;, resulting in: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Disallow root login remotely? [Y/n]&#039;&#039;&#039; Normally, root should only be allowed to connect from &#039;localhost&#039; in order to protect from password sniffing attempts over the network. Enter &#039;Y&#039; to get: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Remove test database and access to it? [Y/n]&#039;&#039;&#039; By default, MariaDB comes with a database named &#039;test&#039; that anyone can access. If this is not needed, &#039;Y&#039;. The response will be: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Reload privilege tables now? [Y/n]&#039;&#039;&#039; Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Answer &#039;Y&#039; and the response will be: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After responding to each question, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so to make always work on each restart set to default as &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Due today were influenced by systemd standardization, the famous &amp;lt;nowiki&amp;gt;my.cnf&amp;lt;/nowiki&amp;gt; are not more the main config file for the server engine. Now only few variables are defined there and all the settings are provided by independent files into the &amp;lt;code&amp;gt;/etc/my.cnf.d/&amp;lt;/code&amp;gt; directory, user own config files are under &amp;lt;code&amp;gt;~/.my.cnf&amp;lt;/code&amp;gt; config file of each home dir, and are read after global ones; so then we have:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Path and name !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| my.cnf || &amp;lt;nowiki&amp;gt;/etc/mysql/my.cnf&amp;lt;/nowiki&amp;gt; || v2 to v3.8 || All the directives, Global config file&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-server.cnf || /etc/my.cnf.d/mariadb-server.cnf || since 3.9 || First Global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| .my.cnf || &amp;lt;nowiki&amp;gt;$HOME&amp;lt;/nowiki&amp;gt; || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously pointed here is the general documentation for normal and common general usage, for professional usage please use [[Production DataBases : mysql]] that is the same as MariaDB but with several modifications focused on production and security.&lt;br /&gt;
&lt;br /&gt;
Newer system Alpine packages can set in independent files in any case those commands always works and where are not apply just will ignore the output:&lt;br /&gt;
&lt;br /&gt;
* First lest allowed all incoming connections if we plan to use in our network or remotely, we do not put focus on security cos we must focus on easy usage and/or development:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=0.0.0.0|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=0.0.0.0|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* So we are a simple install and not are in domain controller, don&#039;t search for hostnames to improve performance responses (ideal for local only servers):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i &amp;quot;s|.*skip-networking.*|skip-networking|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*skip-networking.*|skip-networking|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Major Upgrades between Alpine Linux version are so easy as change the repository version, but the MySQL/MariaDB  engine need some extra steps when this are performed:&lt;br /&gt;
&lt;br /&gt;
Upgrade databases on major releases&lt;br /&gt;
Upon a major version release of mariadb (for example mariadb-10.1.10-1 to mariadb-10.1.18-1), it is wise to upgrade databases:&lt;br /&gt;
&lt;br /&gt;
# keep the old database (mysql scheme) structure of the engine daemon, currently this are not more the case, today this not make sense anymore&lt;br /&gt;
# upgrade the MariaDB/MySQL packages, of course with must be done if the upgrade process to mayor alpine version does not!&lt;br /&gt;
# run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, providing the password or root, (from the new package version) against the old still-running database (mysql scheme). This will produce some error messages; however, the upgrade will succeed.&lt;br /&gt;
# Restart the service&lt;br /&gt;
&lt;br /&gt;
If are unable to run &#039;&#039;mysql_upgrade&#039;&#039; because MySQL cannot start try run MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt; command and then run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[Production DataBases : mysql]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Kmhaga</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=21687</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=21687"/>
		<updated>2022-04-05T10:44:19Z</updated>

		<summary type="html">&lt;p&gt;Kmhaga: /* Configuration files and customization */ fixed spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://mariadb.org/ MariaDB] is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. It is notable for being led by the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is the general documentation for normal and common general usage, for professional usage please use [[Production DataBases : mysql]] that is the same as MariaDB but with several modifications focused on production and security!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has dummy counterparts packages for those that are not close to that change from &#039;&#039;mysql&#039;&#039; to &#039;&#039;mariadb&#039;&#039; naming packages.&lt;br /&gt;
&lt;br /&gt;
Take in consideration that the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt; was created during instalation of packages, in the initialization section two users will be created in database init: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;, and in that point only if are in their respective system accounts, will be able to connect to the database service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add mysql mysql-client&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will install the most used ones.. &amp;lt;code&amp;gt;mariadb-cient&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mariadb-server&amp;lt;/code&amp;gt;, rest of packages are brief described here for more information, here are listed in orden of relevance for production server&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MySQL name package !! Since Alpine: !! Brief usage !! Related package&lt;br /&gt;
|-&lt;br /&gt;
| mysql || v2 || it&#039;s a dummy package to easy install of mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| mysql-client || v2 || it&#039;s a dummy package to easy install of commands tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| mariadb || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-client || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-doc || v3.0 || manpages are there! || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-connector-odbc || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-connector-c || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-backup || v3.8 || to external backup devices, not widely used, in past was inside mariadb package || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-server-utils || v3.8 || server commands not widely used, in past was inside mariadb package || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-dev || v3.1 || Need for compilations depends on source code || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-test || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-mytop || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-plugin-rocksdb || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-static || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-embedded || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-embedded-dev || v3.9 ||  use the normal mysql.h and link with libmysqld instead of libmysqlclient || mariadb-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-openrc || v3.8 || separate scripts, in past was embebed on server package || .&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Initialization ==&lt;br /&gt;
&lt;br /&gt;
The alpine package of MySQL/MariaDB are like normal tarball of MySQL one, admins must know what they want.. there&#039;s no automatic window-like installation here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt; must be owned by the mysql user and group. You can modify this behavior but must edit the service file at &amp;lt;code&amp;gt;/etc/init.d&amp;lt;/code&amp;gt; directory. Also, you need to set &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;datadir=&amp;lt;YOUR_DATADIR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; under section &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; at the config file.&lt;br /&gt;
&lt;br /&gt;
# Initialize the main mysql database, and the data dir as standardized to &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt; by the rc script.&amp;lt;br&amp;gt;/etc/init.d/mariadb setup&lt;br /&gt;
# Then you can start the service but there&#039;s no root password set until this point.&amp;lt;br&amp;gt;/etc/init.d/mariadb start&lt;br /&gt;
# Secure the installation by running&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for manage others users and databases&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to finish setup into &#039;&#039;&#039;MariaDB&#039;&#039;&#039; now provide &#039;&#039;&#039;this script called &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; that also are present as &amp;lt;code&amp;gt;mariadb-secure-installation&amp;lt;/code&amp;gt;&#039;&#039;&#039;, too. This script provides minimal and security setup to the database, and here are the questions made explained:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; If you have previously set up a root password, provide it here and press enter, either just push enter. If correctly entered, the response will be &amp;lt;code&amp;gt;OK, successfully used password, moving on...&amp;lt;/code&amp;gt;&lt;br /&gt;
#  &#039;&#039;&#039;Switch to unix_socket authentication [Y/n]&#039;&#039;&#039; Setting the root password or using the Unix_socket ensures that only admins can log into engine database, cos we are not production one just pust &amp;quot;n&amp;quot; to setup a root password, which will give you the response &amp;lt;code&amp;gt;... skipping.&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Change the root password? [Y/n]&#039;&#039;&#039; This gives you the opportunity to change the root password to a stronger one if necessary. So enter &amp;quot;Y&amp;quot; and lest type the new password.. be carefully with that can be remembered.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Answering &#039;Y&#039;, resulting in: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Disallow root login remotely? [Y/n]&#039;&#039;&#039; Normally, root should only be allowed to connect from &#039;localhost&#039; in order to protect from password sniffing attempts over the network. Enter &#039;Y&#039; to get: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Remove test database and access to it? [Y/n]&#039;&#039;&#039; By default, MariaDB comes with a database named &#039;test&#039; that anyone can access. If this is not needed, &#039;Y&#039;. The response will be: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Reload privilege tables now? [Y/n]&#039;&#039;&#039; Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Answer &#039;Y&#039; and the response will be: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After responding to each question, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so to make always work on each restart set to default as &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Due today were influenced by systemd standardization, the famous &amp;lt;nowiki&amp;gt;my.cnf&amp;lt;/nowiki&amp;gt; are not more the main config file for the server engine. Now only few variables are defined there and all the settings are provided by independent files into the &amp;lt;code&amp;gt;/etc/my.cnf.d/&amp;lt;/code&amp;gt; directory, user own config files are under &amp;lt;code&amp;gt;~/.my.cnf&amp;lt;/code&amp;gt; config file of each home dir, and are read after global ones; so then we have:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Path and name !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| my.cnf || &amp;lt;nowiki&amp;gt;/etc/mysql/my.cnf&amp;lt;/nowiki&amp;gt; || v2 to v3.8 || All the directives, Global config file&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-server.cnf || /etc/my.cnf.d/mariadb-server.cnf || since 3.9 || First Global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| .my.cnf || &amp;lt;nowiki&amp;gt;$HOME&amp;lt;/nowiki&amp;gt; || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously pointed here is the general documentation for normal and common general usage, for professional usage please use [[Production DataBases : mysql]] that is the same as MariaDB but with several modifications focused on production and security.&lt;br /&gt;
&lt;br /&gt;
Newer system Alpine packages can set in independent files in any case those commands always works and where are not apply just will ignore the output:&lt;br /&gt;
&lt;br /&gt;
* First lest allowed all incoming connections if we plan to use in our network or remotely, we do not put focus on security cos we must focus on easy usage and/or development:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=0.0.0.0|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=0.0.0.0|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* So we are a simple install and not are in domain controller, dont search for hostnames to improve performance responses (ideal for local only servers):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i &amp;quot;s|.*skip-networking.*|skip-networking|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*skip-networking.*|skip-networking|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Major Upgrades between Alpine Linux version are so easy as change the repository version, but the MySQL/MariaDB  engine need some extra steps when this are performed:&lt;br /&gt;
&lt;br /&gt;
Upgrade databases on major releases&lt;br /&gt;
Upon a major version release of mariadb (for example mariadb-10.1.10-1 to mariadb-10.1.18-1), it is wise to upgrade databases:&lt;br /&gt;
&lt;br /&gt;
# keep the old database (mysql scheme) structure of the engine daemon, currently this are not more the case, today this not make sense anymore&lt;br /&gt;
# upgrade the MariaDB/MySQL packages, of course with must be done if the upgrade process to mayor alpine version does not!&lt;br /&gt;
# run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, providing the password or root, (from the new package version) against the old still-running database (mysql scheme). This will produce some error messages; however, the upgrade will succeed.&lt;br /&gt;
# Restart the service&lt;br /&gt;
&lt;br /&gt;
If are unable to run &#039;&#039;mysql_upgrade&#039;&#039; because MySQL cannot start try run MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt; command and then run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[Production DataBases : mysql]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Kmhaga</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=21686</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=21686"/>
		<updated>2022-04-05T10:43:38Z</updated>

		<summary type="html">&lt;p&gt;Kmhaga: /* Updating or comming from upgrading */  fixed spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://mariadb.org/ MariaDB] is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. It is notable for being led by the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is the general documentation for normal and common general usage, for professional usage please use [[Production DataBases : mysql]] that is the same as MariaDB but with several modifications focused on production and security!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has dummy counterparts packages for those that are not close to that change from &#039;&#039;mysql&#039;&#039; to &#039;&#039;mariadb&#039;&#039; naming packages.&lt;br /&gt;
&lt;br /&gt;
Take in consideration that the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt; was created during instalation of packages, in the initialization section two users will be created in database init: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;, and in that point only if are in their respective system accounts, will be able to connect to the database service.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add mysql mysql-client&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will install the most used ones.. &amp;lt;code&amp;gt;mariadb-cient&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mariadb-server&amp;lt;/code&amp;gt;, rest of packages are brief described here for more information, here are listed in orden of relevance for production server&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! MySQL name package !! Since Alpine: !! Brief usage !! Related package&lt;br /&gt;
|-&lt;br /&gt;
| mysql || v2 || it&#039;s a dummy package to easy install of mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| mysql-client || v2 || it&#039;s a dummy package to easy install of commands tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| mariadb || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-client || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-doc || v3.0 || manpages are there! || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-connector-odbc || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-connector-c || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-backup || v3.8 || to external backup devices, not widely used, in past was inside mariadb package || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-server-utils || v3.8 || server commands not widely used, in past was inside mariadb package || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-dev || v3.1 || Need for compilations depends on source code || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-test || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-mytop || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-plugin-rocksdb || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-static || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-embedded || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-embedded-dev || v3.9 ||  use the normal mysql.h and link with libmysqld instead of libmysqlclient || mariadb-dev&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-openrc || v3.8 || separate scripts, in past was embebed on server package || .&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Initialization ==&lt;br /&gt;
&lt;br /&gt;
The alpine package of MySQL/MariaDB are like normal tarball of MySQL one, admins must know what they want.. there&#039;s no automatic window-like installation here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt; must be owned by the mysql user and group. You can modify this behavior but must edit the service file at &amp;lt;code&amp;gt;/etc/init.d&amp;lt;/code&amp;gt; directory. Also, you need to set &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;datadir=&amp;lt;YOUR_DATADIR&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; under section &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; at the config file.&lt;br /&gt;
&lt;br /&gt;
# Initialize the main mysql database, and the data dir as standardized to &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt; by the rc script.&amp;lt;br&amp;gt;/etc/init.d/mariadb setup&lt;br /&gt;
# Then you can start the service but there&#039;s no root password set until this point.&amp;lt;br&amp;gt;/etc/init.d/mariadb start&lt;br /&gt;
# Secure the installation by running&amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for manage others users and databases&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to finish setup into &#039;&#039;&#039;MariaDB&#039;&#039;&#039; now provide &#039;&#039;&#039;this script called &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; that also are present as &amp;lt;code&amp;gt;mariadb-secure-installation&amp;lt;/code&amp;gt;&#039;&#039;&#039;, too. This script provides minimal and security setup to the database, and here are the questions made explained:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; If you have previously set up a root password, provide it here and press enter, either just push enter. If correctly entered, the response will be &amp;lt;code&amp;gt;OK, successfully used password, moving on...&amp;lt;/code&amp;gt;&lt;br /&gt;
#  &#039;&#039;&#039;Switch to unix_socket authentication [Y/n]&#039;&#039;&#039; Setting the root password or using the Unix_socket ensures that only admins can log into engine database, cos we are not production one just pust &amp;quot;n&amp;quot; to setup a root password, which will give you the response &amp;lt;code&amp;gt;... skipping.&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Change the root password? [Y/n]&#039;&#039;&#039; This gives you the opportunity to change the root password to a stronger one if necessary. So enter &amp;quot;Y&amp;quot; and lest type the new password.. be carefully with that can be remembered.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Answering &#039;Y&#039;, resulting in: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Disallow root login remotely? [Y/n]&#039;&#039;&#039; Normally, root should only be allowed to connect from &#039;localhost&#039; in order to protect from password sniffing attempts over the network. Enter &#039;Y&#039; to get: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Remove test database and access to it? [Y/n]&#039;&#039;&#039; By default, MariaDB comes with a database named &#039;test&#039; that anyone can access. If this is not needed, &#039;Y&#039;. The response will be: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Reload privilege tables now? [Y/n]&#039;&#039;&#039; Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Answer &#039;Y&#039; and the response will be: &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After responding to each question, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
so to make always work on each restart set to default as &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Due today were influenced by systemd standardization, the famous &amp;lt;nowiki&amp;gt;my.cnf&amp;lt;/nowiki&amp;gt; are not more the main config file for the server engine. Now only few variables are defined there and all the settings are provided by independent files into the &amp;lt;code&amp;gt;/etc/my.cnf.d/&amp;lt;/code&amp;gt; directory, user own config files are under &amp;lt;code&amp;gt;~/.my.cnf&amp;lt;/code&amp;gt; config file of each home dir, and are read after global ones; so then we have:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Path and name !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| my.cnf || &amp;lt;nowiki&amp;gt;/etc/mysql/my.cnf&amp;lt;/nowiki&amp;gt; || v2 to v3.8 || All the directives, Global config file&lt;br /&gt;
|-&lt;br /&gt;
| mariadb-server.cnf || /etc/my.cnf.d/mariadb-server.cnf || since 3.9 || First Global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| .my.cnf || &amp;lt;nowiki&amp;gt;$HOME&amp;lt;/nowiki&amp;gt; || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously pointed here is the general documentation for normal and common general usage, for professional usage please use [[Production DataBases : mysql]] that is the same as MariaDB but with several modifications focused on production and security.&lt;br /&gt;
&lt;br /&gt;
Newer system Alpine packages can set in independent files in any case those commands always works and where are not apply just will ignore the output:&lt;br /&gt;
&lt;br /&gt;
* First lest allowed all incoming connections if we plan to use in our network or remotelly, we do not put focus on security cos we must focus on easy usage and/or development:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=0.0.0.0|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=0.0.0.0|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* So we are a simple install and not are in domain controller, dont search for hostnames to improve performance responses (ideal for local only servers):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i &amp;quot;s|.*skip-networking.*|skip-networking|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*skip-networking.*|skip-networking|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Major Upgrades between Alpine Linux version are so easy as change the repository version, but the MySQL/MariaDB  engine need some extra steps when this are performed:&lt;br /&gt;
&lt;br /&gt;
Upgrade databases on major releases&lt;br /&gt;
Upon a major version release of mariadb (for example mariadb-10.1.10-1 to mariadb-10.1.18-1), it is wise to upgrade databases:&lt;br /&gt;
&lt;br /&gt;
# keep the old database (mysql scheme) structure of the engine daemon, currently this are not more the case, today this not make sense anymore&lt;br /&gt;
# upgrade the MariaDB/MySQL packages, of course with must be done if the upgrade process to mayor alpine version does not!&lt;br /&gt;
# run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, providing the password or root, (from the new package version) against the old still-running database (mysql scheme). This will produce some error messages; however, the upgrade will succeed.&lt;br /&gt;
# Restart the service&lt;br /&gt;
&lt;br /&gt;
If are unable to run &#039;&#039;mysql_upgrade&#039;&#039; because MySQL cannot start try run MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt; command and then run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[Production DataBases : mysql]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Kmhaga</name></author>
	</entry>
</feed>