<?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=Greenman</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=Greenman"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Greenman"/>
	<updated>2026-04-29T18:22:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_production_deployment&amp;diff=29260</id>
		<title>Alpine production deployment</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_production_deployment&amp;diff=29260"/>
		<updated>2025-03-11T23:48:16Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* DataBases */ copyedit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{style|This reads more like an essay than a useful tutorial or advice}}&lt;br /&gt;
The production environment is the final destination of all development results. Almost always when someone does some kind of development, no matter how small it is (for example a simple script), the development environment is not the only place or system where it will be exclusively used (for example the script could be used on other computers in the network).&lt;br /&gt;
&lt;br /&gt;
The development environment is never the same as the production environment, commonly, production environment only has necessary software to run the installed and deployment products. In professional Linux are no graphical tools and everything is minimalist.. just like Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
= Servers and Docker containers =&lt;br /&gt;
&lt;br /&gt;
The most famous cases in old days was use a CentOS environment, but over time, Linux became more heavy and more slow. That changes with Alpine and Docker, if you think Red Hat and CentOS are the best here an article that describes in short the real life of those systems: https://gitea.com/venenux/venenux/src/branch/master/docs/others-infodocs-details-centos-vs-fedora-en.md , Both projects are Red Hat related, one are ahead of and the other behind of, main difference from others distributions it’s their lack of packages and setups, due the shared market focused target of both.. obviously due the RedHAt relationship.&lt;br /&gt;
&lt;br /&gt;
But today all of this changed, now there&#039;s Docker: a helpful tool for packaging, shipping, and running applications within &amp;quot;containers&amp;quot; (like virtual machines) that remove the need for physical hardware, allowing for more efficient use of computing resources, in terms of energy consumption and cost effectiveness. Today even the big dogs like Google, VMware and Amazon are building services to support it.&lt;br /&gt;
&lt;br /&gt;
The server are mostly a very powerful machine in production environments, but think about it! a 500GB disk to only run a DNS for a local network? that&#039;s the reason of the Dockers and their relationship with the servers. &lt;br /&gt;
&lt;br /&gt;
The one big difference between containers and a Server is that containers *share* the host server system’s kernel and server resources with other containers in a isolated environment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Server focused documents ==&lt;br /&gt;
&lt;br /&gt;
TODO: webpack, npm (advanced.. cos is includen below in lamp), bigdata, Dockers focused well made tutorial&lt;br /&gt;
&lt;br /&gt;
=== Web deploy: LAMP ===&lt;br /&gt;
&lt;br /&gt;
In production web, LAMP means &#039;&#039;&#039;L&#039;&#039;&#039;inux + &#039;&#039;&#039;A&#039;&#039;&#039;pache + &#039;&#039;&#039;M&#039;&#039;&#039;ysql + &#039;&#039;&#039;P&#039;&#039;&#039;hp installed and integrated, but today the &amp;quot;A&amp;quot; of apache is more used as Nginx or Lighttpd, and the &amp;quot;M&amp;quot; of MySQL is more used as [[MariaDB]]. The LAMP focused documents are:&lt;br /&gt;
&lt;br /&gt;
* LAMP deploy of the Web Server: [[Production Web server: Lighttpd]]&lt;br /&gt;
* LAMP deploy of the Web Server with PHP, user html_dir and [[MariaDB]]: [[MySQL]]&lt;br /&gt;
* Deploy usage of Lets Encrypt without chain-tools – just add water: [[Production Lets Encrypt: dehydrated]]&lt;br /&gt;
&lt;br /&gt;
=== Web deploy: LUA ===&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
== Databases ==&lt;br /&gt;
&lt;br /&gt;
* SQlite, most easy to use database system without engine: [[Debelovers : sqlite]]&lt;br /&gt;
* UnixODBC, how to connect with multiple databases: [[Production DataBases : unixodbc]]&lt;br /&gt;
* MySQL/MariaDB deployment: [[MariaDB]]/[[MySQL]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* Dual stack (ipv4 to ipv6) DNS with chain slave, just only for brave linux sysadmin: : [[Production DNS: dual stack Bind server]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
&lt;br /&gt;
== Docker focused documents ==&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:PHP]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_production_deployment&amp;diff=29259</id>
		<title>Alpine production deployment</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_production_deployment&amp;diff=29259"/>
		<updated>2025-03-11T23:48:07Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* DataBases */ link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{style|This reads more like an essay than a useful tutorial or advice}}&lt;br /&gt;
The production environment is the final destination of all development results. Almost always when someone does some kind of development, no matter how small it is (for example a simple script), the development environment is not the only place or system where it will be exclusively used (for example the script could be used on other computers in the network).&lt;br /&gt;
&lt;br /&gt;
The development environment is never the same as the production environment, commonly, production environment only has necessary software to run the installed and deployment products. In professional Linux are no graphical tools and everything is minimalist.. just like Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
= Servers and Docker containers =&lt;br /&gt;
&lt;br /&gt;
The most famous cases in old days was use a CentOS environment, but over time, Linux became more heavy and more slow. That changes with Alpine and Docker, if you think Red Hat and CentOS are the best here an article that describes in short the real life of those systems: https://gitea.com/venenux/venenux/src/branch/master/docs/others-infodocs-details-centos-vs-fedora-en.md , Both projects are Red Hat related, one are ahead of and the other behind of, main difference from others distributions it’s their lack of packages and setups, due the shared market focused target of both.. obviously due the RedHAt relationship.&lt;br /&gt;
&lt;br /&gt;
But today all of this changed, now there&#039;s Docker: a helpful tool for packaging, shipping, and running applications within &amp;quot;containers&amp;quot; (like virtual machines) that remove the need for physical hardware, allowing for more efficient use of computing resources, in terms of energy consumption and cost effectiveness. Today even the big dogs like Google, VMware and Amazon are building services to support it.&lt;br /&gt;
&lt;br /&gt;
The server are mostly a very powerful machine in production environments, but think about it! a 500GB disk to only run a DNS for a local network? that&#039;s the reason of the Dockers and their relationship with the servers. &lt;br /&gt;
&lt;br /&gt;
The one big difference between containers and a Server is that containers *share* the host server system’s kernel and server resources with other containers in a isolated environment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Server focused documents ==&lt;br /&gt;
&lt;br /&gt;
TODO: webpack, npm (advanced.. cos is includen below in lamp), bigdata, Dockers focused well made tutorial&lt;br /&gt;
&lt;br /&gt;
=== Web deploy: LAMP ===&lt;br /&gt;
&lt;br /&gt;
In production web, LAMP means &#039;&#039;&#039;L&#039;&#039;&#039;inux + &#039;&#039;&#039;A&#039;&#039;&#039;pache + &#039;&#039;&#039;M&#039;&#039;&#039;ysql + &#039;&#039;&#039;P&#039;&#039;&#039;hp installed and integrated, but today the &amp;quot;A&amp;quot; of apache is more used as Nginx or Lighttpd, and the &amp;quot;M&amp;quot; of MySQL is more used as [[MariaDB]]. The LAMP focused documents are:&lt;br /&gt;
&lt;br /&gt;
* LAMP deploy of the Web Server: [[Production Web server: Lighttpd]]&lt;br /&gt;
* LAMP deploy of the Web Server with PHP, user html_dir and [[MariaDB]]: [[MySQL]]&lt;br /&gt;
* Deploy usage of Lets Encrypt without chain-tools – just add water: [[Production Lets Encrypt: dehydrated]]&lt;br /&gt;
&lt;br /&gt;
=== Web deploy: LUA ===&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
== DataBases ==&lt;br /&gt;
&lt;br /&gt;
* SQlite, most easy to use database system without engine: [[Debelovers : sqlite]]&lt;br /&gt;
* UnixODBC, how to connect with multiple databases: [[Production DataBases : unixodbc]]&lt;br /&gt;
* MySQL/MariaDB deployment: [[MariaDB]]/[[MySQL]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* Dual stack (ipv4 to ipv6) DNS with chain slave, just only for brave linux sysadmin: : [[Production DNS: dual stack Bind server]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
&lt;br /&gt;
== Docker focused documents ==&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:PHP]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_production_deployment&amp;diff=29258</id>
		<title>Alpine production deployment</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_production_deployment&amp;diff=29258"/>
		<updated>2025-03-11T23:47:41Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Web deploy: LAMP */links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{style|This reads more like an essay than a useful tutorial or advice}}&lt;br /&gt;
The production environment is the final destination of all development results. Almost always when someone does some kind of development, no matter how small it is (for example a simple script), the development environment is not the only place or system where it will be exclusively used (for example the script could be used on other computers in the network).&lt;br /&gt;
&lt;br /&gt;
The development environment is never the same as the production environment, commonly, production environment only has necessary software to run the installed and deployment products. In professional Linux are no graphical tools and everything is minimalist.. just like Alpine Linux.&lt;br /&gt;
&lt;br /&gt;
= Servers and Docker containers =&lt;br /&gt;
&lt;br /&gt;
The most famous cases in old days was use a CentOS environment, but over time, Linux became more heavy and more slow. That changes with Alpine and Docker, if you think Red Hat and CentOS are the best here an article that describes in short the real life of those systems: https://gitea.com/venenux/venenux/src/branch/master/docs/others-infodocs-details-centos-vs-fedora-en.md , Both projects are Red Hat related, one are ahead of and the other behind of, main difference from others distributions it’s their lack of packages and setups, due the shared market focused target of both.. obviously due the RedHAt relationship.&lt;br /&gt;
&lt;br /&gt;
But today all of this changed, now there&#039;s Docker: a helpful tool for packaging, shipping, and running applications within &amp;quot;containers&amp;quot; (like virtual machines) that remove the need for physical hardware, allowing for more efficient use of computing resources, in terms of energy consumption and cost effectiveness. Today even the big dogs like Google, VMware and Amazon are building services to support it.&lt;br /&gt;
&lt;br /&gt;
The server are mostly a very powerful machine in production environments, but think about it! a 500GB disk to only run a DNS for a local network? that&#039;s the reason of the Dockers and their relationship with the servers. &lt;br /&gt;
&lt;br /&gt;
The one big difference between containers and a Server is that containers *share* the host server system’s kernel and server resources with other containers in a isolated environment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Server focused documents ==&lt;br /&gt;
&lt;br /&gt;
TODO: webpack, npm (advanced.. cos is includen below in lamp), bigdata, Dockers focused well made tutorial&lt;br /&gt;
&lt;br /&gt;
=== Web deploy: LAMP ===&lt;br /&gt;
&lt;br /&gt;
In production web, LAMP means &#039;&#039;&#039;L&#039;&#039;&#039;inux + &#039;&#039;&#039;A&#039;&#039;&#039;pache + &#039;&#039;&#039;M&#039;&#039;&#039;ysql + &#039;&#039;&#039;P&#039;&#039;&#039;hp installed and integrated, but today the &amp;quot;A&amp;quot; of apache is more used as Nginx or Lighttpd, and the &amp;quot;M&amp;quot; of MySQL is more used as [[MariaDB]]. The LAMP focused documents are:&lt;br /&gt;
&lt;br /&gt;
* LAMP deploy of the Web Server: [[Production Web server: Lighttpd]]&lt;br /&gt;
* LAMP deploy of the Web Server with PHP, user html_dir and [[MariaDB]]: [[MySQL]]&lt;br /&gt;
* Deploy usage of Lets Encrypt without chain-tools – just add water: [[Production Lets Encrypt: dehydrated]]&lt;br /&gt;
&lt;br /&gt;
=== Web deploy: LUA ===&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
== DataBases ==&lt;br /&gt;
&lt;br /&gt;
* SQlite, most easy to use database system without engine: [[Debelovers : sqlite]]&lt;br /&gt;
* UnixODBC, how to connect with multiple databases: [[Production DataBases : unixodbc]]&lt;br /&gt;
* MySQL/MariaDB deployment: [[MySQL]]&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
&lt;br /&gt;
* Dual stack (ipv4 to ipv6) DNS with chain slave, just only for brave linux sysadmin: : [[Production DNS: dual stack Bind server]]&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]]&lt;br /&gt;
&lt;br /&gt;
== Docker focused documents ==&lt;br /&gt;
&lt;br /&gt;
WIP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:PHP]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29257</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29257"/>
		<updated>2025-03-11T23:46:51Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* HTTP and web services */ MariaDB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions. Howto&#039;s have been organized in the below page based on the topics.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The [[#Tutorials|tutorials]] are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* Contributors are requested to refer to [[Help:Editing]] first and make use of resources like [[How to write a HOWTO]].&lt;br /&gt;
* Contributions must be complete articles. &lt;br /&gt;
* Don&#039;t override already made contributions, unless there is a mistake. &lt;br /&gt;
* If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].}}&lt;br /&gt;
&lt;br /&gt;
== Desktop ==&lt;br /&gt;
&lt;br /&gt;
* {{:Daily driver guide}}&lt;br /&gt;
=== Power management ===&lt;br /&gt;
&lt;br /&gt;
* [[Configure action when power-button is pressed]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Configure Wake-on-LAN]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]] - Instructions for installing and configuring Bluetooth&lt;br /&gt;
* [[Bonding]] - Bond (or aggregate) multiple ethernet interfaces&lt;br /&gt;
* [[Bridge]] - Configuring a network bridge&lt;br /&gt;
** [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* Modem&lt;br /&gt;
** [[Using HSDPA modem]]&lt;br /&gt;
** [[Using serial modem]]&lt;br /&gt;
* [[mDNS]] - Howto implement multicast DNS resolution in Alpine. &lt;br /&gt;
* [[Multi ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
* Wi-Fi&lt;br /&gt;
** [[Wi-Fi|Connecting to a wireless access point]]&lt;br /&gt;
** [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[VLAN]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
&lt;br /&gt;
* [[Securing Alpine Linux]] How to Secure Alpine Linux using Security Technical Implementation Guides (STIGs)&lt;br /&gt;
* Understand [[UEFI]] and enable [[UEFI Secure Boot]]&lt;br /&gt;
&lt;br /&gt;
=== Backup and data migration ===&lt;br /&gt;
&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Rsnapshot]] - setting up periodic backups&lt;br /&gt;
&lt;br /&gt;
=== Other topics ===&lt;br /&gt;
&lt;br /&gt;
* [[Gaming on Alpine]]&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Default applications|How to change default application]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
* [[Mimalloc]]&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
* [[How to build the Alpine Linux kernel]]&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
* [[Desktop environments and Window managers|List of supported Desktop environments and Window managers]]&lt;br /&gt;
&lt;br /&gt;
== Diskless ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]]&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
== Other Architectures ==&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
==== Raspberry Pi ====&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi main page]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker|Raspberry Pi - Bluetooth Speaker]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi|Raspberry Pi - Router with VPN]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)|Raspberry Pi - Router with VPN (IPv6)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi|Raspberry Pi - Sys mode install]]&lt;br /&gt;
* [[Raspberry Pi LVM on LUKS|Raspberry Pi - Sys mode install - LVM on LUKS]]&lt;br /&gt;
* [[RPI Video Receiver|Raspberry Pi - Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[How to set up Alpine as a wireless router|Raspberry Pi Zero W - Wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[RPI Video Receiver]]&lt;br /&gt;
&lt;br /&gt;
=== IBM Z (IBM z Systems) ===&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x - Installation]]&lt;br /&gt;
&lt;br /&gt;
=== PowerPC ===&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le - Installation]]&lt;br /&gt;
&lt;br /&gt;
== Services == &lt;br /&gt;
&lt;br /&gt;
{{Note| Services are arranged in alphabetical order.}}&lt;br /&gt;
&lt;br /&gt;
=== Content management systems ===&lt;br /&gt;
&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[Moodle]] &#039;&#039;(Online Learning Management system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Database === &lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]] or [[MySQL|MySQL]]&lt;br /&gt;
&lt;br /&gt;
=== DNS ===&lt;br /&gt;
&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[Small-Time DNS with BIND9]] &#039;&#039;(A simple configuration with ad blocking for your home network)&#039;&#039;&lt;br /&gt;
* Unbound&lt;br /&gt;
** [[Setting up unbound DNS server]]&lt;br /&gt;
** [[Using Unbound as an Ad-blocker]] &#039;&#039;(Setup ad blocking for your network)&#039;&#039;&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
&lt;br /&gt;
=== File server ===&lt;br /&gt;
&lt;br /&gt;
* [[Setting up an NFS server|nfs-server]]&lt;br /&gt;
* [[Setting up a Samba server|samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc|samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall and VPN ===&lt;br /&gt;
&lt;br /&gt;
* Alpine Wall &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
** [[Alpine Wall]]&lt;br /&gt;
** [https://git.alpinelinux.org/awall/about/ Alpine Wall User&#039;s Guide]&lt;br /&gt;
** [[How-To Alpine Wall]]&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
* [[Setting up a OpenVPN server|OpenVPN server]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)|Wireguard]]&lt;br /&gt;
* [[IGMPproxy]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP and web services ===&lt;br /&gt;
&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Advanced security]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
** [[Nginx with PHP]]&lt;br /&gt;
* Squid Proxy&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
** [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
** [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎|Production LAMP system: Lighttpd + PHP + MariaDB/MySQL‎‎]]&lt;br /&gt;
&lt;br /&gt;
=== IRC ===&lt;br /&gt;
&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
* [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* Exim/Dovecot&lt;br /&gt;
** [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
** [[Setting up dovecot with imap and tls]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
* [[relay email (nullmailer)]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* Server protection&lt;br /&gt;
** [[Setting up clamsmtp]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Logcheck]] &#039;&#039;(log file monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Matomo]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Rasdaemon]] &#039;&#039;(Platform Reliability, Availability and Serviceability monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance; for alpine 3.10-3.12 only)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
** [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
=== Remote Administration ===&lt;br /&gt;
&lt;br /&gt;
* ACF&lt;br /&gt;
** [[Changing passwords for ACF|ACF - changing passwords]]&lt;br /&gt;
** [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
** [[setup-acf| ACF - setup]] &#039;&#039;(Configures ACF (webconfiguration/webmin) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator |OpenSSH 2FA]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
&lt;br /&gt;
* [[FreePBX|FreePBX on Alpine Linux]]&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
&lt;br /&gt;
* [[apcupsd]] &#039;&#039;(UPS Monitoring with apcupsd)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[nut-ups|NUT UPS]] &#039;&#039;(UPS Monitoring with Network UPS Tools)&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
* [[Configure OpenLDAP | OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a LLDAP server|lldap-server]] &#039;&#039;(Directory Server)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software development ==&lt;br /&gt;
&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java|Oracle Java (installation)]]&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually|Manual partitioning]]&lt;br /&gt;
* [[Disk Replication with DRBD|DRBD: Disk Replication]]&lt;br /&gt;
* [[Filesystems]]&lt;br /&gt;
** [[Burning ISOs]]&lt;br /&gt;
* [[Setting up iSCSI|iSCSI Setup]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
** [[Linux iSCSI Target (TCM)|iSCSI Target (TCM)/LinuxIO (LIO)]]&lt;br /&gt;
** [[Linux iSCSI Target (tgt)|User space iSCSI Target (tgt)]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM|LVM Setup]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks|LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM|LVM on GPT-labeled disks (updated)]]&lt;br /&gt;
** [[LVM on LUKS]]&lt;br /&gt;
* RAID&lt;br /&gt;
** [[Raid Administration]]&lt;br /&gt;
** [[Setting up a software RAID array]]&lt;br /&gt;
* ZFS&lt;br /&gt;
** [[Root on ZFS with native encryption]]&lt;br /&gt;
** [[Setting up ZFS on LUKS]]&lt;br /&gt;
** [[Setting up ZFS with native encryption]]&lt;br /&gt;
** [[ZFS scrub and trim]]&lt;br /&gt;
* [[CEPH|CEPH]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Installing Alpine in a virtual machine]]&lt;br /&gt;
** [[Install Alpine on VMware ESXi]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* Xen&lt;br /&gt;
** [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
** [[Xen Dom0 on USB or SD]]&lt;br /&gt;
** [[Create Alpine Linux PV DomU|Xen DomU (paravirtualized)]]&lt;br /&gt;
** [[Xen LiveCD]]&lt;br /&gt;
** [[Xen PCI Passthrough]]&lt;br /&gt;
** [[K8s]] Building a K8s Kubernetes Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* [[TTY_Autologin|TTY Autologin]]&lt;br /&gt;
* [[Kexec|Faster rebooting with kexec]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[ISP Mail Server 3.x HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-service ISP mail server)&#039;&#039;&lt;br /&gt;
* [[Grommunio Mail Server]] &#039;&#039;(Mariadb+Postfix+Rspamd+Grommunio - Full-service mail server as MS exchange replacement)&#039;&#039;&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Install Alpine on a btrfs filesystem with refind as boot manager]]&lt;br /&gt;
* [[Compile software from source|How to Compile a software from source in Alpine Linux]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29256</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29256"/>
		<updated>2025-03-11T23:45:48Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* HTTP and web services */ MariaDB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions. Howto&#039;s have been organized in the below page based on the topics.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The [[#Tutorials|tutorials]] are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* Contributors are requested to refer to [[Help:Editing]] first and make use of resources like [[How to write a HOWTO]].&lt;br /&gt;
* Contributions must be complete articles. &lt;br /&gt;
* Don&#039;t override already made contributions, unless there is a mistake. &lt;br /&gt;
* If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].}}&lt;br /&gt;
&lt;br /&gt;
== Desktop ==&lt;br /&gt;
&lt;br /&gt;
* {{:Daily driver guide}}&lt;br /&gt;
=== Power management ===&lt;br /&gt;
&lt;br /&gt;
* [[Configure action when power-button is pressed]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Configure Wake-on-LAN]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]] - Instructions for installing and configuring Bluetooth&lt;br /&gt;
* [[Bonding]] - Bond (or aggregate) multiple ethernet interfaces&lt;br /&gt;
* [[Bridge]] - Configuring a network bridge&lt;br /&gt;
** [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* Modem&lt;br /&gt;
** [[Using HSDPA modem]]&lt;br /&gt;
** [[Using serial modem]]&lt;br /&gt;
* [[mDNS]] - Howto implement multicast DNS resolution in Alpine. &lt;br /&gt;
* [[Multi ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
* Wi-Fi&lt;br /&gt;
** [[Wi-Fi|Connecting to a wireless access point]]&lt;br /&gt;
** [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[VLAN]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
&lt;br /&gt;
* [[Securing Alpine Linux]] How to Secure Alpine Linux using Security Technical Implementation Guides (STIGs)&lt;br /&gt;
* Understand [[UEFI]] and enable [[UEFI Secure Boot]]&lt;br /&gt;
&lt;br /&gt;
=== Backup and data migration ===&lt;br /&gt;
&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Rsnapshot]] - setting up periodic backups&lt;br /&gt;
&lt;br /&gt;
=== Other topics ===&lt;br /&gt;
&lt;br /&gt;
* [[Gaming on Alpine]]&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Default applications|How to change default application]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
* [[Mimalloc]]&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
* [[How to build the Alpine Linux kernel]]&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
* [[Desktop environments and Window managers|List of supported Desktop environments and Window managers]]&lt;br /&gt;
&lt;br /&gt;
== Diskless ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]]&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
== Other Architectures ==&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
==== Raspberry Pi ====&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi main page]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker|Raspberry Pi - Bluetooth Speaker]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi|Raspberry Pi - Router with VPN]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)|Raspberry Pi - Router with VPN (IPv6)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi|Raspberry Pi - Sys mode install]]&lt;br /&gt;
* [[Raspberry Pi LVM on LUKS|Raspberry Pi - Sys mode install - LVM on LUKS]]&lt;br /&gt;
* [[RPI Video Receiver|Raspberry Pi - Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[How to set up Alpine as a wireless router|Raspberry Pi Zero W - Wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[RPI Video Receiver]]&lt;br /&gt;
&lt;br /&gt;
=== IBM Z (IBM z Systems) ===&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x - Installation]]&lt;br /&gt;
&lt;br /&gt;
=== PowerPC ===&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le - Installation]]&lt;br /&gt;
&lt;br /&gt;
== Services == &lt;br /&gt;
&lt;br /&gt;
{{Note| Services are arranged in alphabetical order.}}&lt;br /&gt;
&lt;br /&gt;
=== Content management systems ===&lt;br /&gt;
&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[Moodle]] &#039;&#039;(Online Learning Management system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Database === &lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]] or [[MySQL|MySQL]]&lt;br /&gt;
&lt;br /&gt;
=== DNS ===&lt;br /&gt;
&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[Small-Time DNS with BIND9]] &#039;&#039;(A simple configuration with ad blocking for your home network)&#039;&#039;&lt;br /&gt;
* Unbound&lt;br /&gt;
** [[Setting up unbound DNS server]]&lt;br /&gt;
** [[Using Unbound as an Ad-blocker]] &#039;&#039;(Setup ad blocking for your network)&#039;&#039;&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
&lt;br /&gt;
=== File server ===&lt;br /&gt;
&lt;br /&gt;
* [[Setting up an NFS server|nfs-server]]&lt;br /&gt;
* [[Setting up a Samba server|samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc|samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall and VPN ===&lt;br /&gt;
&lt;br /&gt;
* Alpine Wall &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
** [[Alpine Wall]]&lt;br /&gt;
** [https://git.alpinelinux.org/awall/about/ Alpine Wall User&#039;s Guide]&lt;br /&gt;
** [[How-To Alpine Wall]]&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
* [[Setting up a OpenVPN server|OpenVPN server]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)|Wireguard]]&lt;br /&gt;
* [[IGMPproxy]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP and web services ===&lt;br /&gt;
&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Advanced security]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
** [[Nginx with PHP]]&lt;br /&gt;
* Squid Proxy&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
** [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
** [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MariaDB/MySQL‎‎]]&lt;br /&gt;
&lt;br /&gt;
=== IRC ===&lt;br /&gt;
&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
* [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* Exim/Dovecot&lt;br /&gt;
** [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
** [[Setting up dovecot with imap and tls]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
* [[relay email (nullmailer)]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* Server protection&lt;br /&gt;
** [[Setting up clamsmtp]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Logcheck]] &#039;&#039;(log file monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Matomo]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Rasdaemon]] &#039;&#039;(Platform Reliability, Availability and Serviceability monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance; for alpine 3.10-3.12 only)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
** [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
=== Remote Administration ===&lt;br /&gt;
&lt;br /&gt;
* ACF&lt;br /&gt;
** [[Changing passwords for ACF|ACF - changing passwords]]&lt;br /&gt;
** [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
** [[setup-acf| ACF - setup]] &#039;&#039;(Configures ACF (webconfiguration/webmin) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator |OpenSSH 2FA]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
&lt;br /&gt;
* [[FreePBX|FreePBX on Alpine Linux]]&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
&lt;br /&gt;
* [[apcupsd]] &#039;&#039;(UPS Monitoring with apcupsd)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[nut-ups|NUT UPS]] &#039;&#039;(UPS Monitoring with Network UPS Tools)&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
* [[Configure OpenLDAP | OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a LLDAP server|lldap-server]] &#039;&#039;(Directory Server)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software development ==&lt;br /&gt;
&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java|Oracle Java (installation)]]&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually|Manual partitioning]]&lt;br /&gt;
* [[Disk Replication with DRBD|DRBD: Disk Replication]]&lt;br /&gt;
* [[Filesystems]]&lt;br /&gt;
** [[Burning ISOs]]&lt;br /&gt;
* [[Setting up iSCSI|iSCSI Setup]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
** [[Linux iSCSI Target (TCM)|iSCSI Target (TCM)/LinuxIO (LIO)]]&lt;br /&gt;
** [[Linux iSCSI Target (tgt)|User space iSCSI Target (tgt)]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM|LVM Setup]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks|LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM|LVM on GPT-labeled disks (updated)]]&lt;br /&gt;
** [[LVM on LUKS]]&lt;br /&gt;
* RAID&lt;br /&gt;
** [[Raid Administration]]&lt;br /&gt;
** [[Setting up a software RAID array]]&lt;br /&gt;
* ZFS&lt;br /&gt;
** [[Root on ZFS with native encryption]]&lt;br /&gt;
** [[Setting up ZFS on LUKS]]&lt;br /&gt;
** [[Setting up ZFS with native encryption]]&lt;br /&gt;
** [[ZFS scrub and trim]]&lt;br /&gt;
* [[CEPH|CEPH]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Installing Alpine in a virtual machine]]&lt;br /&gt;
** [[Install Alpine on VMware ESXi]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* Xen&lt;br /&gt;
** [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
** [[Xen Dom0 on USB or SD]]&lt;br /&gt;
** [[Create Alpine Linux PV DomU|Xen DomU (paravirtualized)]]&lt;br /&gt;
** [[Xen LiveCD]]&lt;br /&gt;
** [[Xen PCI Passthrough]]&lt;br /&gt;
** [[K8s]] Building a K8s Kubernetes Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* [[TTY_Autologin|TTY Autologin]]&lt;br /&gt;
* [[Kexec|Faster rebooting with kexec]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[ISP Mail Server 3.x HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-service ISP mail server)&#039;&#039;&lt;br /&gt;
* [[Grommunio Mail Server]] &#039;&#039;(Mariadb+Postfix+Rspamd+Grommunio - Full-service mail server as MS exchange replacement)&#039;&#039;&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Install Alpine on a btrfs filesystem with refind as boot manager]]&lt;br /&gt;
* [[Compile software from source|How to Compile a software from source in Alpine Linux]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29255</id>
		<title>Tutorials and Howtos</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Tutorials_and_Howtos&amp;diff=29255"/>
		<updated>2025-03-11T23:45:16Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Database */ MariaDB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:package_edutainment.svg|right|link=]]&lt;br /&gt;
{{TOC left}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Welcome to Tutorials and Howtos, a place of basic and advanced configuration tasks for your Alpine Linux.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Howtos are smaller articles&#039;&#039;&#039; explaining how to perform a particular task with Alpine Linux, that expects a minimal knowledge from reader to perform actions. Howto&#039;s have been organized in the below page based on the topics.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The [[#Tutorials|tutorials]] are hands-on&#039;&#039;&#039; and the reader is expected to try and achieve the goals described in each step, possibly with the help of a good example. The output in one step is the starting point for the following step.&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* Contributors are requested to refer to [[Help:Editing]] first and make use of resources like [[How to write a HOWTO]].&lt;br /&gt;
* Contributions must be complete articles. &lt;br /&gt;
* Don&#039;t override already made contributions, unless there is a mistake. &lt;br /&gt;
* If you want to request a topic, please add your request in this page&#039;s [[Talk:Tutorials_and_Howtos|Discussion]].}}&lt;br /&gt;
&lt;br /&gt;
== Desktop ==&lt;br /&gt;
&lt;br /&gt;
* {{:Daily driver guide}}&lt;br /&gt;
=== Power management ===&lt;br /&gt;
&lt;br /&gt;
* [[Configure action when power-button is pressed]]&lt;br /&gt;
* [[Suspend on LID close]]&lt;br /&gt;
* [[Configure Wake-on-LAN]]&lt;br /&gt;
&lt;br /&gt;
=== Networking ===&lt;br /&gt;
&lt;br /&gt;
* [[Bluetooth]] - Instructions for installing and configuring Bluetooth&lt;br /&gt;
* [[Bonding]] - Bond (or aggregate) multiple ethernet interfaces&lt;br /&gt;
* [[Bridge]] - Configuring a network bridge&lt;br /&gt;
** [[Bridge wlan0 to eth0]]&lt;br /&gt;
* [[Configure Networking]]&lt;br /&gt;
* [[How to configure static routes]]&lt;br /&gt;
* Modem&lt;br /&gt;
** [[Using HSDPA modem]]&lt;br /&gt;
** [[Using serial modem]]&lt;br /&gt;
* [[mDNS]] - Howto implement multicast DNS resolution in Alpine. &lt;br /&gt;
* [[Multi ISP]] &#039;&#039;(Dual-ISP setup with load-balancing and automatic failover)&#039;&#039;&lt;br /&gt;
* [[PXE boot]]&lt;br /&gt;
* Wi-Fi&lt;br /&gt;
** [[Wi-Fi|Connecting to a wireless access point]]&lt;br /&gt;
** [[How to setup a wireless access point]] &#039;&#039;(Setting up Secure Wireless AP w/ WPA encryption with bridge to wired network)&#039;&#039;&lt;br /&gt;
* [[VLAN]]&lt;br /&gt;
&lt;br /&gt;
=== Security ===&lt;br /&gt;
&lt;br /&gt;
* [[Securing Alpine Linux]] How to Secure Alpine Linux using Security Technical Implementation Guides (STIGs)&lt;br /&gt;
* Understand [[UEFI]] and enable [[UEFI Secure Boot]]&lt;br /&gt;
&lt;br /&gt;
=== Backup and data migration ===&lt;br /&gt;
&lt;br /&gt;
* [[Migrating data]]&lt;br /&gt;
* [[Rsnapshot]] - setting up periodic backups&lt;br /&gt;
&lt;br /&gt;
=== Other topics ===&lt;br /&gt;
&lt;br /&gt;
* [[Gaming on Alpine]]&lt;br /&gt;
* [[Remote Desktop Server]]&lt;br /&gt;
* [[Default applications|How to change default application]]&lt;br /&gt;
* [[CPU frequency scaling]]&lt;br /&gt;
* [[Mimalloc]]&lt;br /&gt;
* [[Enable Serial Console on Boot]]&lt;br /&gt;
* [[How to build the Alpine Linux kernel]]&lt;br /&gt;
* [[Nextcloud]] &#039;&#039;(Self hostable cloud suite - Dropbox Alternative)&#039;&#039;&lt;br /&gt;
* [[Setting up lm_sensors]]&lt;br /&gt;
* [[Desktop environments and Window managers|List of supported Desktop environments and Window managers]]&lt;br /&gt;
&lt;br /&gt;
== Diskless ==&lt;br /&gt;
&lt;br /&gt;
* [[Alpine local backup|Alpine local backup (lbu)]] &#039;&#039;(Permanently store your modifications in case your box needs reboot)&#039;&#039;&lt;br /&gt;
** [[Back Up a Flash Memory Installation]]&lt;br /&gt;
** [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
== Other Architectures ==&lt;br /&gt;
&lt;br /&gt;
=== ARM ===&lt;br /&gt;
&lt;br /&gt;
* [[Alpine on ARM]]&lt;br /&gt;
&lt;br /&gt;
==== Raspberry Pi ====&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi|Raspberry Pi main page]]&lt;br /&gt;
* [[Raspberry Pi Bluetooth Speaker|Raspberry Pi - Bluetooth Speaker]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi|Raspberry Pi - Router with VPN]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi (IPv6)|Raspberry Pi - Router with VPN (IPv6)]]&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi|Raspberry Pi - Sys mode install]]&lt;br /&gt;
* [[Raspberry Pi LVM on LUKS|Raspberry Pi - Sys mode install - LVM on LUKS]]&lt;br /&gt;
* [[RPI Video Receiver|Raspberry Pi - Video Receiver]] &#039;&#039;(network video decoder using Rasperry Pi and omxplayer)&#039;&#039;&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]] - kiosk or digital sign&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine]]&lt;br /&gt;
* [[How to set up Alpine as a wireless router|Raspberry Pi Zero W - Wireless router]] &#039;&#039;(Setting up a firewalled, Wireless AP with wired network on a Pi Zero W)&#039;&#039;&lt;br /&gt;
* [[RPI Video Receiver]]&lt;br /&gt;
&lt;br /&gt;
=== IBM Z (IBM z Systems) ===&lt;br /&gt;
&lt;br /&gt;
* [[s390x|s390x - Installation]]&lt;br /&gt;
&lt;br /&gt;
=== PowerPC ===&lt;br /&gt;
&lt;br /&gt;
* [[Ppc64le|Powerpc64le - Installation]]&lt;br /&gt;
&lt;br /&gt;
== Services == &lt;br /&gt;
&lt;br /&gt;
{{Note| Services are arranged in alphabetical order.}}&lt;br /&gt;
&lt;br /&gt;
=== Content management systems ===&lt;br /&gt;
&lt;br /&gt;
* [[DokuWiki]]&lt;br /&gt;
* [[Drupal]] &#039;&#039;(Content Management System (CMS) written in PHP)&#039;&#039;&lt;br /&gt;
* [[Kopano]] &#039;&#039;(Microsoft Outlook compatible Groupware)&#039;&#039;&lt;br /&gt;
* [[Mahara]] &#039;&#039;(E-portfolio and social networking system)&#039;&#039;&lt;br /&gt;
* [[MediaWiki]] &#039;&#039;(Free web-based wiki software application)&#039;&#039;&lt;br /&gt;
* [[Pastebin]] &#039;&#039;(Pastebin software application)&#039;&#039;&lt;br /&gt;
* [[WordPress]] &#039;&#039;(Web software to create website or blog)&#039;&#039;&lt;br /&gt;
* [[Moodle]] &#039;&#039;(Online Learning Management system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Database === &lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]] or [[MySQL|MySQL]]&lt;br /&gt;
&lt;br /&gt;
=== DNS ===&lt;br /&gt;
&lt;br /&gt;
* [[DNSCrypt-Proxy]] &#039;&#039;Encrypt and authenticate DNS calls from your system&#039;&#039;&lt;br /&gt;
* [[Setting up nsd DNS server]]&lt;br /&gt;
* [[Small-Time DNS with BIND9]] &#039;&#039;(A simple configuration with ad blocking for your home network)&#039;&#039;&lt;br /&gt;
* Unbound&lt;br /&gt;
** [[Setting up unbound DNS server]]&lt;br /&gt;
** [[Using Unbound as an Ad-blocker]] &#039;&#039;(Setup ad blocking for your network)&#039;&#039;&lt;br /&gt;
* [[TinyDNS Format]]&lt;br /&gt;
&lt;br /&gt;
=== File server ===&lt;br /&gt;
&lt;br /&gt;
* [[Setting up an NFS server|nfs-server]]&lt;br /&gt;
* [[Setting up a Samba server|samba-server]] &#039;&#039;(standard file sharing)&#039;&#039;&lt;br /&gt;
* [[Setting up a samba-ad-dc|samba-ad-dc]] &#039;&#039;(Active Directory compatible domain controller)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Firewall and VPN ===&lt;br /&gt;
&lt;br /&gt;
* Alpine Wall &#039;&#039;(a new firewall management framework)&#039;&#039;&lt;br /&gt;
** [[Alpine Wall]]&lt;br /&gt;
** [https://git.alpinelinux.org/awall/about/ Alpine Wall User&#039;s Guide]&lt;br /&gt;
** [[How-To Alpine Wall]]&lt;br /&gt;
* [[Freeradius Active Directory Integration]]&lt;br /&gt;
* [[GNUnet]]&lt;br /&gt;
* [[Setting up a OpenVPN server|OpenVPN server]] &#039;&#039;(Allowing single users or devices to remotely connect to your network)&#039;&#039;&lt;br /&gt;
* [[OpenVSwitch]]&lt;br /&gt;
* [[Using Alpine on Windows domain with IPSEC isolation]]&lt;br /&gt;
* [[Configure a Wireguard interface (wg)|Wireguard]]&lt;br /&gt;
* [[IGMPproxy]]&lt;br /&gt;
&lt;br /&gt;
=== HTTP and web services ===&lt;br /&gt;
&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
** [[Apache with php-fpm]]&lt;br /&gt;
** [[Setting Up Apache with PHP]]&lt;br /&gt;
** [[Apache authentication: NTLM Single Signon]]&lt;br /&gt;
* [[Darkhttpd]]&lt;br /&gt;
* [[Lighttpd]]&lt;br /&gt;
** [[Lighttpd Advanced security]]&lt;br /&gt;
** [[Setting Up Lighttpd With FastCGI]]&lt;br /&gt;
** [[Production Web server: Lighttpd|Production web server: Lighttpd‎‎]]&lt;br /&gt;
* [[Nginx]]&lt;br /&gt;
** [[Nginx as reverse proxy with acme (letsencrypt)]]&lt;br /&gt;
** [[Nginx with PHP]]&lt;br /&gt;
* Squid Proxy&lt;br /&gt;
** [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
** [[Setting up Explicit Squid Proxy]]&lt;br /&gt;
** [[Setting up Transparent Squid Proxy]] &#039;&#039;(Covers Squid proxy and URL Filtering system)&#039;&#039;&lt;br /&gt;
** [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Tomcat]]&lt;br /&gt;
** [[Production LAMP system: Lighttpd + PHP + MySQL‎‎]]&lt;br /&gt;
&lt;br /&gt;
=== IRC ===&lt;br /&gt;
&lt;br /&gt;
* [[NgIRCd]] &#039;&#039;(Server for Internet Relay Chat/IRC)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Mail ===&lt;br /&gt;
&lt;br /&gt;
* [[Hosting services on Alpine]] &#039;&#039;(Hosting mail, webservices and other services)&#039;&#039;&lt;br /&gt;
* [[Hosting Web/Email services on Alpine]]&lt;br /&gt;
* Exim/Dovecot&lt;br /&gt;
** [[Small-Time Email with Exim and Dovecot]] &#039;&#039;(A simple configuration for your home network.)&lt;br /&gt;
** [[Setting up dovecot with imap and tls]]&lt;br /&gt;
* [[relay email to gmail (msmtp, mailx, sendmail]]&lt;br /&gt;
* [[relay email (nullmailer)]]&lt;br /&gt;
* [[Roundcube]] &#039;&#039;(Webmail system)&#039;&#039;&lt;br /&gt;
* [[Setting up postfix with virtual domains]]&lt;br /&gt;
* Server protection&lt;br /&gt;
** [[Setting up clamsmtp]]&lt;br /&gt;
&lt;br /&gt;
=== Monitoring ===&lt;br /&gt;
&lt;br /&gt;
* [[Awstats]] &#039;&#039;(Free log file analyzer)&#039;&#039;&lt;br /&gt;
* [[Cacti: traffic analysis and monitoring network]] &#039;&#039;(Front-end for rrdtool networking monitor)&#039;&#039;&lt;br /&gt;
* [[Cvechecker]] &#039;&#039;(Compare installed packages for Common Vulnerabilities Exposure)&#039;&#039; &amp;lt;!-- Monitoring and Security --&amp;gt;&lt;br /&gt;
* [[Linfo]]&lt;br /&gt;
* [[Obtaining user information via SNMP]] &#039;&#039;(Using squark-auth-snmp as a Squid authentication helper)&#039;&#039; &amp;lt;!-- Networking and Server, &amp;lt;== Using squark-auth-snmp --&amp;gt;&lt;br /&gt;
* [[PhpSysInfo]] &#039;&#039;(A simple application that displays information about the host it&#039;s running on)&#039;&#039;&lt;br /&gt;
* [[Logcheck]] &#039;&#039;(log file monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Matomo]] &#039;&#039;(A real time web analytics software program)&#039;&#039;&lt;br /&gt;
* [[Rasdaemon]] &#039;&#039;(Platform Reliability, Availability and Serviceability monitoring tool)&#039;&#039;&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft, solution, Networking and Monitoring and Server --&amp;gt;&lt;br /&gt;
** [[Setting up NRPE daemon]] &#039;&#039;(Performs remote Nagios checks)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[Setting Up Fprobe And Ntop|Ntop]] &#039;&#039;(NetFlow collection and analysis using a remote fprobe instance; for alpine 3.10-3.12 only)&#039;&#039; &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
* [[SqStat]] &#039;&#039;(Script to look at active squid users connections)&#039;&#039;&lt;br /&gt;
* [[Traffic monitoring]] &amp;lt;!-- Networking and Monitoring --&amp;gt;&lt;br /&gt;
** [[Setting up monitoring using rrdtool (and rrdcollect)]]&lt;br /&gt;
** [[Setting up traffic monitoring using rrdtool (and snmp)]] &amp;lt;!-- Monitoring --&amp;gt;&lt;br /&gt;
* [[Zabbix|Zabbix - the professional complete manager]] &#039;&#039;(Monitor and track the status of network services and hardware)&#039;&#039;&lt;br /&gt;
* [[ZoneMinder video camera security and surveillance]]&lt;br /&gt;
&lt;br /&gt;
=== Remote Administration ===&lt;br /&gt;
&lt;br /&gt;
* ACF&lt;br /&gt;
** [[Changing passwords for ACF|ACF - changing passwords]]&lt;br /&gt;
** [[Generating SSL certs with ACF]] &amp;lt;!-- Generating SSL certs with ACF 1.9 --&amp;gt;&lt;br /&gt;
** [[setup-acf| ACF - setup]] &#039;&#039;(Configures ACF (webconfiguration/webmin) so you can manage your box through https)&#039;&#039;&lt;br /&gt;
* [[Setting up a SSH server]] &#039;&#039;(Using ssh is a good way to administer your box remotely)&#039;&#039;&lt;br /&gt;
** [[HOWTO OpenSSH 2FA with password and Google Authenticator |OpenSSH 2FA]] &#039;&#039;(A simple two factor setup for OpenSSH)&#039;&#039;&lt;br /&gt;
* [[OpenVCP]] &#039;&#039;(VServer Control Panel)&#039;&#039;&lt;br /&gt;
* [[PhpMyAdmin]] &#039;&#039;(Web-based administration tool for MYSQL)&#039;&#039;&lt;br /&gt;
* [[PhpPgAdmin]] &#039;&#039;(Web-based administration tool for PostgreSQL)&#039;&#039;&lt;br /&gt;
* [[Webmin]] &#039;&#039;(A web-based interface for Linux system)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Telephony ===&lt;br /&gt;
&lt;br /&gt;
* [[FreePBX|FreePBX on Alpine Linux]]&lt;br /&gt;
* [[Setting up Zaptel/Asterisk on Alpine]]&lt;br /&gt;
* [[Kamailio]] &#039;&#039;(SIP Server, formerly OpenSER)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Other Servers ===&lt;br /&gt;
&lt;br /&gt;
* [[apcupsd]] &#039;&#039;(UPS Monitoring with apcupsd)&#039;&#039;&lt;br /&gt;
* [[Chrony and GPSD | Chrony, gpsd, and a garmin LVC 18 as a Stratum 1 NTP source ]]&lt;br /&gt;
* [[Glpi]] &#039;&#039;(Manage inventory of technical resources)&#039;&#039;&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
* [[nut-ups|NUT UPS]] &#039;&#039;(UPS Monitoring with Network UPS Tools)&#039;&#039;&lt;br /&gt;
* [[Odoo]]&lt;br /&gt;
* [[Configure OpenLDAP | OpenLDAP]] &#039;&#039;(Installing and configuring the Alpine package for OpenLDAP)&#039;&#039;&lt;br /&gt;
* [[Setting up a LLDAP server|lldap-server]] &#039;&#039;(Directory Server)&#039;&#039;&lt;br /&gt;
* [[Setting up Transmission (bittorrent) with Clutch WebUI]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software development ==&lt;br /&gt;
&lt;br /&gt;
* [[Cgit]]&lt;br /&gt;
* [[OsTicket]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Patchwork]] &#039;&#039;(Patch review management system)&#039;&#039;&lt;br /&gt;
* [[Redmine]] &#039;&#039;(Project management system)&#039;&#039;&lt;br /&gt;
* [[Request Tracker]] &#039;&#039;(Ticket system)&#039;&#039;&lt;br /&gt;
* [[Setting up trac wiki|Trac]] &#039;&#039;(Enhanced wiki and issue tracking system for software development projects)&#039;&#039;&lt;br /&gt;
* [[Ansible]] &#039;&#039;(Configuration management)&#039;&#039;&lt;br /&gt;
* [[Installing Oracle Java|Oracle Java (installation)]]&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
&lt;br /&gt;
* [[Setting up disks manually|Manual partitioning]]&lt;br /&gt;
* [[Disk Replication with DRBD|DRBD: Disk Replication]]&lt;br /&gt;
* [[Filesystems]]&lt;br /&gt;
** [[Burning ISOs]]&lt;br /&gt;
* [[Setting up iSCSI|iSCSI Setup]]&lt;br /&gt;
** [[iSCSI Raid and Clustered File Systems]]&lt;br /&gt;
** [[Linux iSCSI Target (TCM)|iSCSI Target (TCM)/LinuxIO (LIO)]]&lt;br /&gt;
** [[Linux iSCSI Target (tgt)|User space iSCSI Target (tgt)]]&lt;br /&gt;
* [[Setting up Logical Volumes with LVM|LVM Setup]]&lt;br /&gt;
** [[Setting up LVM on GPT-labeled disks|LVM on GPT-labeled disks]]&lt;br /&gt;
** [[Installing on GPT LVM|LVM on GPT-labeled disks (updated)]]&lt;br /&gt;
** [[LVM on LUKS]]&lt;br /&gt;
* RAID&lt;br /&gt;
** [[Raid Administration]]&lt;br /&gt;
** [[Setting up a software RAID array]]&lt;br /&gt;
* ZFS&lt;br /&gt;
** [[Root on ZFS with native encryption]]&lt;br /&gt;
** [[Setting up ZFS on LUKS]]&lt;br /&gt;
** [[Setting up ZFS with native encryption]]&lt;br /&gt;
** [[ZFS scrub and trim]]&lt;br /&gt;
* [[CEPH|CEPH]]&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
&lt;br /&gt;
* [[Docker]]&lt;br /&gt;
* [[Installing Alpine in a virtual machine]]&lt;br /&gt;
** [[Install Alpine on VMware ESXi]]&lt;br /&gt;
* [[KVM]] &#039;&#039;(Setting up Alpine as a KVM hypervisor)&#039;&#039;&lt;br /&gt;
* [[LXC]] &#039;&#039;(Setting up a Linux container in Alpine Linux)&#039;&#039;&lt;br /&gt;
* [[QEMU]]&lt;br /&gt;
* Xen&lt;br /&gt;
** [[Xen Dom0]] &#039;&#039;(Setting up Alpine as a dom0 for Xen hypervisor)&#039;&#039;&lt;br /&gt;
** [[Xen Dom0 on USB or SD]]&lt;br /&gt;
** [[Create Alpine Linux PV DomU|Xen DomU (paravirtualized)]]&lt;br /&gt;
** [[Xen LiveCD]]&lt;br /&gt;
** [[Xen PCI Passthrough]]&lt;br /&gt;
** [[K8s]] Building a K8s Kubernetes Cluster on Alpine Linux&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
* [[TTY_Autologin|TTY Autologin]]&lt;br /&gt;
* [[Kexec|Faster rebooting with kexec]]&lt;br /&gt;
* [[Dynamic Multipoint VPN (DMVPN)]] combined with [[Small Office Services]]&lt;br /&gt;
* [[DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs]]&lt;br /&gt;
* [[Fault Tolerant Routing with Alpine Linux]]&lt;br /&gt;
* [[High Availability High Performance Web Cache]] &#039;&#039;(uCarp + HAProxy for High Availability Services such as Squid web proxy)&#039;&#039;&lt;br /&gt;
* [[Linux iSCSI Target (TCM)]]&lt;br /&gt;
* [[ISP Mail Server 3.x HowTo]] &#039;&#039;(Postfix+PostfixAdmin+DoveCot+Roundcube+ClamAV+Spamd - A full-service ISP mail server)&#039;&#039;&lt;br /&gt;
* [[Grommunio Mail Server]] &#039;&#039;(Mariadb+Postfix+Rspamd+Grommunio - Full-service mail server as MS exchange replacement)&#039;&#039;&lt;br /&gt;
* [[Replacing non-Alpine Linux with Alpine remotely]]&lt;br /&gt;
* [[Setting up A Network Monitoring and Inventory System]] &#039;&#039;(Nagios + OpenAudit and related components)&#039;&#039; &amp;lt;!-- draft --&amp;gt;&lt;br /&gt;
* [[Streaming Security Camera Video with VLC]]&lt;br /&gt;
* [[Install Alpine on a btrfs filesystem with refind as boot manager]]&lt;br /&gt;
* [[Compile software from source|How to Compile a software from source in Alpine Linux]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29254</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29254"/>
		<updated>2025-03-11T23:43:54Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Create a user */ this is not enough&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;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
The Alpine Linux repositories no longer include the actual MySQL binaries, installing the &amp;lt;code&amp;gt;mysql-*&amp;lt;/code&amp;gt; packages will instead install MariaDB. &lt;br /&gt;
&lt;br /&gt;
Installing &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; will create the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. When the database is initialized, two users will be added to the database: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. By default these users will only be accessible if you are logged in as the corresponding system user.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add {{pkg|mariadb|arch=}} {{pkg|mariadb-client|arch=}}}}&lt;br /&gt;
&lt;br /&gt;
Installing the above packages will add the main components of MariaDB to the system: &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;. Other available packages are described in the table below, and are listed in order of relevance for a 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;
| {{Pkg|mysql}} || v2 || a transitional package that installs mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mysql-client}} || v2 || a transitional package that installs the mariadb client tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb}} || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-client}} || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-doc}} || v3.0 || manpages for mariadb || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-odbc}} || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-c}} || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-backup}} || v3.8 || tool for physical online backups, no longer widely used || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-server-utils}} || v3.8 || server commands not widely used, in past was inside MariaDB package || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-dev}} || v3.1 || development files for MariaDB || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-test}} || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-mytop}} || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-plugin-rocksdb}} || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-static}} || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-embedded}} || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|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;
| {{Pkg|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 version of MariaDB in the Alpine repositories behave like the MySQL tarball. No graphical tools are included.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at {{Path|/var/lib/mysql}} must be owned by the mysql user and group. The location of the &#039;&#039;datadir&#039;&#039; can be changed by editing the &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; service file in {{Path|/etc/init.d}}. The new location will also need to be set by adding &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; in the &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; section in a mariadb configuration file.&lt;br /&gt;
&lt;br /&gt;
Normal initialization of mariadb can be done as follows:&lt;br /&gt;
&lt;br /&gt;
# Start the main service. At this point there will be no root password set. &amp;lt;code&amp;gt;rc-service mariadb start&amp;lt;/code&amp;gt;&lt;br /&gt;
# Secure the database by running &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for managing others users and databases see: &#039;&#039;&#039;[[#Configuration|Configuration]]&#039;&#039;&#039;&lt;br /&gt;
# Add MariaDb to OpenRC. &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to help with the basic configuration of the database engine, MariaDB provides [https://mariadb.com/kb/en/mariadb-secure-installation/ mariadb-secure-installation]. &lt;br /&gt;
&lt;br /&gt;
Many of the reasons for running this script are no longer necessary, since MariaDB has defaulted to Unix socket authentication since MariaDB 10.4.&lt;br /&gt;
&lt;br /&gt;
This script walks you through the basics of securing the database. The options are explained below.&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. If not, just press enter.&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. For non-production servers just press &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; Here you can change the root password, or set one if needed. Press &amp;quot;Y&amp;quot; and enter the new password.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Unless you&#039;re sure you need this, answer &amp;quot;Y&amp;quot; to remove them.&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. Answer &amp;quot;Y&amp;quot;.&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, answer &amp;quot;Y&amp;quot;.&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 &amp;quot;Y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
After the script exits, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start the database daemon on every boot, run &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Rather than being stored in {{Path|my.cnf}}, configuration settings for MariaDB are now organized in separate files. The primary configuration is done by adding files to {{Path|/etc/my.cnf.d/}}. User-specific configuration files are stored in {{Path|~/.my.cnf}}. User-specific configuration files are loaded after the system-wide configuration. The locations of the various configuration files are listed below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/mysql/my.cnf}} || v2 to v3.8 || All the directives, global config file&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/my.cnf.d/mariadb-server.cnf}} || since 3.9 || First global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| {{path|$HOME/.my.cnf}} || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, this page describes basic usage of MariaDB. For professional usage, [[MySQL]] should also be referenced.&lt;br /&gt;
&lt;br /&gt;
* The following command will configure the server to accept all incoming connections. This should only be done for development, or if the database is not exposed to the Internet or a sensitive network.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
* For simple installations, disabling hostname search can improve performance, but is only useful for local servers.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
When upgrading between Alpine Linux releases, MariaDB may also have a major version change, and the databases should be upgraded to match. The recommended steps in this process are detailed below.&lt;br /&gt;
&lt;br /&gt;
# While it may no longer be strictly necessary, it&#039;s useful to backup your databases before upgrading the database version.&lt;br /&gt;
# Update Alpine Linux and the MariaDB/MySQL packages.&lt;br /&gt;
# Install mariadb-server-utils by running &amp;lt;code&amp;gt;apk add {{pkg|mariadb-server-utils|arch=}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, and provide the password for the root database user.&lt;br /&gt;
# Restart the service by running &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;mysql_upgrade&amp;lt;/code&amp;gt; fails because MySQL cannot start, try running MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt;, and then run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
= Create a user =&lt;br /&gt;
You may want to create a user with remote access to the database.&lt;br /&gt;
&lt;br /&gt;
Open mariadb Client: &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add the user with associated host and password: &amp;lt;code&amp;gt; CREATE OR REPLACE USER admin@&#039;%&#039; IDENTIFIED BY &#039;ASecurePassword&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: @&#039;%&#039; allow connection from any host&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is insufficient to allow remote access. See [https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/ Configuring MariaDB for Remote Client Access].&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MySQL]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29253</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29253"/>
		<updated>2025-03-11T23:42:39Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Create a user */ ce&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;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
The Alpine Linux repositories no longer include the actual MySQL binaries, installing the &amp;lt;code&amp;gt;mysql-*&amp;lt;/code&amp;gt; packages will instead install MariaDB. &lt;br /&gt;
&lt;br /&gt;
Installing &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; will create the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. When the database is initialized, two users will be added to the database: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. By default these users will only be accessible if you are logged in as the corresponding system user.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add {{pkg|mariadb|arch=}} {{pkg|mariadb-client|arch=}}}}&lt;br /&gt;
&lt;br /&gt;
Installing the above packages will add the main components of MariaDB to the system: &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;. Other available packages are described in the table below, and are listed in order of relevance for a 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;
| {{Pkg|mysql}} || v2 || a transitional package that installs mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mysql-client}} || v2 || a transitional package that installs the mariadb client tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb}} || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-client}} || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-doc}} || v3.0 || manpages for mariadb || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-odbc}} || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-c}} || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-backup}} || v3.8 || tool for physical online backups, no longer widely used || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-server-utils}} || v3.8 || server commands not widely used, in past was inside MariaDB package || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-dev}} || v3.1 || development files for MariaDB || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-test}} || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-mytop}} || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-plugin-rocksdb}} || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-static}} || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-embedded}} || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|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;
| {{Pkg|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 version of MariaDB in the Alpine repositories behave like the MySQL tarball. No graphical tools are included.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at {{Path|/var/lib/mysql}} must be owned by the mysql user and group. The location of the &#039;&#039;datadir&#039;&#039; can be changed by editing the &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; service file in {{Path|/etc/init.d}}. The new location will also need to be set by adding &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; in the &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; section in a mariadb configuration file.&lt;br /&gt;
&lt;br /&gt;
Normal initialization of mariadb can be done as follows:&lt;br /&gt;
&lt;br /&gt;
# Start the main service. At this point there will be no root password set. &amp;lt;code&amp;gt;rc-service mariadb start&amp;lt;/code&amp;gt;&lt;br /&gt;
# Secure the database by running &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for managing others users and databases see: &#039;&#039;&#039;[[#Configuration|Configuration]]&#039;&#039;&#039;&lt;br /&gt;
# Add MariaDb to OpenRC. &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to help with the basic configuration of the database engine, MariaDB provides [https://mariadb.com/kb/en/mariadb-secure-installation/ mariadb-secure-installation]. &lt;br /&gt;
&lt;br /&gt;
Many of the reasons for running this script are no longer necessary, since MariaDB has defaulted to Unix socket authentication since MariaDB 10.4.&lt;br /&gt;
&lt;br /&gt;
This script walks you through the basics of securing the database. The options are explained below.&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. If not, just press enter.&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. For non-production servers just press &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; Here you can change the root password, or set one if needed. Press &amp;quot;Y&amp;quot; and enter the new password.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Unless you&#039;re sure you need this, answer &amp;quot;Y&amp;quot; to remove them.&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. Answer &amp;quot;Y&amp;quot;.&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, answer &amp;quot;Y&amp;quot;.&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 &amp;quot;Y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
After the script exits, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start the database daemon on every boot, run &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Rather than being stored in {{Path|my.cnf}}, configuration settings for MariaDB are now organized in separate files. The primary configuration is done by adding files to {{Path|/etc/my.cnf.d/}}. User-specific configuration files are stored in {{Path|~/.my.cnf}}. User-specific configuration files are loaded after the system-wide configuration. The locations of the various configuration files are listed below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/mysql/my.cnf}} || v2 to v3.8 || All the directives, global config file&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/my.cnf.d/mariadb-server.cnf}} || since 3.9 || First global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| {{path|$HOME/.my.cnf}} || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, this page describes basic usage of MariaDB. For professional usage, [[MySQL]] should also be referenced.&lt;br /&gt;
&lt;br /&gt;
* The following command will configure the server to accept all incoming connections. This should only be done for development, or if the database is not exposed to the Internet or a sensitive network.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
* For simple installations, disabling hostname search can improve performance, but is only useful for local servers.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
When upgrading between Alpine Linux releases, MariaDB may also have a major version change, and the databases should be upgraded to match. The recommended steps in this process are detailed below.&lt;br /&gt;
&lt;br /&gt;
# While it may no longer be strictly necessary, it&#039;s useful to backup your databases before upgrading the database version.&lt;br /&gt;
# Update Alpine Linux and the MariaDB/MySQL packages.&lt;br /&gt;
# Install mariadb-server-utils by running &amp;lt;code&amp;gt;apk add {{pkg|mariadb-server-utils|arch=}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, and provide the password for the root database user.&lt;br /&gt;
# Restart the service by running &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;mysql_upgrade&amp;lt;/code&amp;gt; fails because MySQL cannot start, try running MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt;, and then run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
= Create a user =&lt;br /&gt;
You may want to create a user with remote access to the database.&lt;br /&gt;
&lt;br /&gt;
Open mariadb Client: &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add the user with associated host and password: &amp;lt;code&amp;gt; CREATE OR REPLACE USER admin@&#039;%&#039; IDENTIFIED BY &#039;ASecurePassword&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: @&#039;%&#039; allow connection from any host&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MySQL]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Zabbix_-_cgi_and_mysql&amp;diff=29252</id>
		<title>Zabbix - cgi and mysql</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Zabbix_-_cgi_and_mysql&amp;diff=29252"/>
		<updated>2025-03-11T23:38:57Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Zabbix infraestructure */ sp, rest needs improvement too&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Zabbix is the most popular monitoring manager in open source world, there&#039;s monitoring itself only like [[Cacti:_traffic_analysis_and_monitoring_network|catci]], but the hint is that &#039;&#039;&#039;&#039;&#039;Zabbix&#039;&#039;&#039; is manager also, &#039;&#039;&#039;is ipv6 ready! fully supported&#039;&#039;&#039;, also featured proxy-server for hidden and firewalled networks.&#039;&#039; Its like nagios one but more big, cutting edge and professional.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, [[Production_monitoring_:_zabbix|the professional one]] (for servers and deploys) and the fast and simple usage (for developers and/or enthusiasts). For more curses on that (of course focused on alpine) check [https://qgqlochekone.blogspot.com/search/?q=zabbix Complete alpine documentation on english for zabbix curse]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This documentation is divided in two big parts.. the prerequisites and the installation&#039;&#039;&#039; of zabbix minimal infrastructure. The first part are in sync with the current alpine wiki pages of [https://wiki.alpinelinux.org/wiki/Category:Production Production pages]&lt;br /&gt;
&lt;br /&gt;
Note: There is a possibility that this page may have been complexified / obfuscated. See the talk page or review an earlier edit: https://wiki.alpinelinux.org/w/index.php?title=Zabbix&amp;amp;oldid=17984.&lt;br /&gt;
[[File:Zabbix-5-alpine.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
= Where to use zabbix and alpine =&lt;br /&gt;
&lt;br /&gt;
Since Zabbix it focuses on hosts: So &#039;&#039;&#039;is the right choice for monitoring distributed networks&#039;&#039;&#039; (was originally developed for monitoring servers).&lt;br /&gt;
&lt;br /&gt;
In cases where there is no option to install an agent, Zabbix offers basic agentless monitoring. With it, you can check the availability of network services, as well as execute remote commands&lt;br /&gt;
&lt;br /&gt;
== Zabbix infrastructure ==&lt;br /&gt;
&lt;br /&gt;
Zabbix is divided into &#039;&#039;&#039;two large parts: server(s) and agent(s)&#039;&#039;&#039;, and yes &amp;quot;servers&amp;quot; cos can be centralized or decentralized due the &amp;quot;proxyes&amp;quot; semi-servers.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;The servers&#039;&#039;&#039;: represent all the &#039;&#039;&#039;recollected data&#039;&#039;&#039; and &#039;&#039;&#039;has management capabilities&#039;&#039;&#039;. Each one if are more than one, collects and stores statistical data.&lt;br /&gt;
* &#039;&#039;&#039;The agents&#039;&#039;&#039;: represent each host, the clients, those machines or devices from which data is collected. Those support both passive (polling) and active checks (trapping).&lt;br /&gt;
* &#039;&#039;&#039;The proxys&#039;&#039;&#039;: represent a server that can act as man-in-the-middle for distributed load, cases of hideden networking or firewalled, of course &#039;&#039;&#039;with management capabilities cos act as server&#039;&#039;&#039; for those agents/hosts.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Passive checks&#039;&#039;&#039; mean that the Zabbix server requests a value from the Zabbix agent, and the agent processes the request and returns the value to the Zabbix server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Active checks&#039;&#039;&#039; mean that the Zabbix agent requests a list of active checks from the Zabbix server and then periodically sends the results.&lt;br /&gt;
&lt;br /&gt;
[[File:Zabbix-agent-server-proxy-main-remote.jpg|center]]&lt;br /&gt;
&lt;br /&gt;
= Part 1 Pre-requisites: php, webserver and database =&lt;br /&gt;
&lt;br /&gt;
{{:Production_LAMP_system:_Lighttpd_+_PHP_+_MySQL}}&lt;br /&gt;
&lt;br /&gt;
= Part 2: zabbix =&lt;br /&gt;
&lt;br /&gt;
Zabbix depends on which type of database you will use, here we will show you how to doit with mysql, as more easy to use, for production is recommended posrgresql as in &lt;br /&gt;
&lt;br /&gt;
== 1. install zabbix packages ==&lt;br /&gt;
&lt;br /&gt;
Remenber that Zabbix has 3 components, and the server is the main one&lt;br /&gt;
&lt;br /&gt;
* Central servers to represent the data ( can be one zabbix server, o combined zabbix server with more zabbix proxies)&lt;br /&gt;
* Clients hosts to monitored (that is made by Agents, SNMP or just ICMP)&lt;br /&gt;
* Distributed proxy servers (that is only need for hosts behind firewall or closed networks)&lt;br /&gt;
&lt;br /&gt;
In the server we need the central base service at leas, and of course one agent for monitoring that server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
https://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
https://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add zabbix zabbix-mysql zabbix-webif zabbix-setup zabbix-utils zabbix-agentd&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now lest configure the server and the UI frontend in that server:&lt;br /&gt;
&lt;br /&gt;
== 2. Configure the base service ==&lt;br /&gt;
&lt;br /&gt;
Server zabbix, or proxy one always need a main database, the service of monitoring is running with it, the UI and agents always send the data to the zabbix server or zabbix proxy (and from proxy to server).&lt;br /&gt;
&lt;br /&gt;
{{Warning|The &#039;&#039;&#039;zabbix service DB user is &amp;lt;code&amp;gt;zabbixdb&amp;lt;/code&amp;gt; and NOT &amp;lt;code&amp;gt;zabbix&amp;lt;/code&amp;gt;&#039;&#039;&#039;, the user &amp;lt;code&amp;gt;zabbixdb&amp;lt;/code&amp;gt; whatever you use postgresql or mysql, will not be used with password for agent monitoring, cos in postgresql will use the &amp;lt;code&amp;gt;ident&amp;lt;/code&amp;gt; way autentication, and in mysql will use the &amp;lt;code&amp;gt;socket&amp;lt;/code&amp;gt; way autentication: &#039;&#039;&#039;this makes sense cos user agent is &amp;lt;code&amp;gt;zabbix&amp;lt;/code&amp;gt; and does not have home.&#039;&#039;&#039; This is the correct and most secure way.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql -u root -e &amp;quot;CREATE USER &#039;zabbix&#039;@&#039;localhost&#039; IDENTIFIED VIA mysql_native_password USING PASSWORD(&#039;clavezabix&#039;);&amp;quot;&lt;br /&gt;
mysql -u root -e &amp;quot;CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;&amp;quot;&lt;br /&gt;
mysql -u root -e &amp;quot;GRANT ALL PRIVILEGES ON zabbixdb.* TO &#039;zabbixdb&#039;@&#039;localhost&#039; WITH GRANT OPTION;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u zabbixdb --password=clavezabix zabbixdb &amp;lt; /usr/share/zabbix/database/mysql/schema.sql&lt;br /&gt;
mysql -u zabbixdb --password=clavezabix zabbixdb &amp;lt; /usr/share/zabbix/database/mysql/images.sql&lt;br /&gt;
mysql -u zabbixdb --password=clavezabix zabbixdb &amp;lt; /usr/share/zabbix/database/mysql/data.sql&lt;br /&gt;
&lt;br /&gt;
sed -i &#039;s|.*DBHost.*=.*|DBHost=localhost|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|DBName.*=.*|DBName=zabbixdb|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|.*DBPassword.*=.*|DBPassword=zabbixdb.db.1.com.1|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|.*DBUser.*=.*|DBUser=zabbixdb|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|.*DBSocket.*=.*|DBSocket=/run/mysqld/mysqld.sock|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|.*Fping6Location.*=.*|Fping6Location=|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|.*FpingLocation.*=.*|FpingLocation=/usr/sbin/fping|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|Nostname=.*|Nostname=monitor.zabbixnetwork|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
sed -i &#039;s|.*SourceIP.*=.*|SourceIP=0.0.0.0|g&#039; /etc/zabbix/zabbix_server.conf&lt;br /&gt;
&lt;br /&gt;
chown root:zabbix /usr/sbin/fping&lt;br /&gt;
&lt;br /&gt;
rc-update add zabbix-server default&lt;br /&gt;
&lt;br /&gt;
rc-service zabbix-server restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|Remenber that the hostname of the server is &amp;lt;nowiki&amp;gt;monitor.zabbixnetwork&amp;lt;/nowiki&amp;gt;, you can use the ip address too, but this name must be the same in the config files for active or passive servers, the web ui configured hostname server and/or zabbix configured hostname proxy server.}}&lt;br /&gt;
&lt;br /&gt;
== 3. Setup and configure web frontend ==&lt;br /&gt;
&lt;br /&gt;
The main server can be managed with the zabbix-frontend:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cp /usr/share/webapps/zabbix/conf/zabbix.conf.php.example /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*DB\[&#039;TYPE&#039;\].*=.*|\$DB\[&#039;TYPE&#039;\] = &#039;MYSQL&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*DB\[&#039;SERVER&#039;\].*=.*|\$DB\[&#039;SERVER&#039;\] = &#039;localhost&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*DB\[&#039;DATABASE&#039;\].*=.*|\$DB\[&#039;DATABASE&#039;\] = &#039;zabbixdb&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*DB\[&#039;USER&#039;\].*=.*|\$DB\[&#039;USER&#039;\] = &#039;zabbixdb&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*DB\[&#039;PASSWORD&#039;\].*=.*|\$DB\[&#039;PASSWORD&#039;\] = &#039;zabbixdb.db.1.com.1&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*ZBX_SERVER_PORT.*=.*|\$ZBX_SERVER_PORT = &#039;10051&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*ZBX_SERVER_NAME.*=.*|\$ZBX_SERVER_NAME = &#039;monitor.ruices&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*IMAGE_FORMAT_DEFAULT.*=.*|\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_GIF;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
sed -i &amp;quot;s|.*ZBX_SERVER.*=.*&#039;localhost&#039;;|\$ZBX_SERVER = &#039;localhost&#039;;|g&amp;quot; /usr/share/webapps/zabbix/conf/zabbix.conf.php&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /usr/share/webapps/zabbix/.user.ini &amp;lt;&amp;lt; EOF&lt;br /&gt;
date.timezone = &amp;quot;America/Caracas&amp;quot;&lt;br /&gt;
display_errors  =  Off&lt;br /&gt;
log_errors  =  On&lt;br /&gt;
upload_max_filesize  =  16M&lt;br /&gt;
post_max_size  =  24M&lt;br /&gt;
memory_limit  =  512M&lt;br /&gt;
register_globals  =  Off&lt;br /&gt;
magic_quotes_gpc  =  Off&lt;br /&gt;
magic_quotes_runtime  =  Off&lt;br /&gt;
session.auto_start  = 0&lt;br /&gt;
mbstring.func_overload = 0&lt;br /&gt;
max_execution_time = 600&lt;br /&gt;
max_input_time = 600&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We do not use the stupid link of direct put on htdocs, we are professional and we use aliasing, &lt;br /&gt;
now lest configure the webserver to server the frontend by web:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_zabbix.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
alias.url += (&lt;br /&gt;
     &amp;quot;/zabbix/&amp;quot;    =&amp;gt;    &amp;quot;/usr/share/webapps/zabbix/&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
\$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/zabbix/&amp;quot; {&lt;br /&gt;
    dir-listing.activate = &amp;quot;disable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i &#039;s#\#.*mod_rewrite.*,.*#    &amp;quot;mod_rewrite&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i &#039;s#\#.*mod_accesslog.*,.*#    &amp;quot;mod_accesslog&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i &#039;s#\#.*mod_setenv.*,.*#    &amp;quot;mod_setenv&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i &#039;s#\#.*mod_redirect.*,.*#    &amp;quot;mod_redirect&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
check=&amp;quot;&amp;quot;;check=$(grep &#039;include &amp;quot;mod_zabbix.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$check&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || sed -i &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;\ninclude &amp;quot;mod_zabbix.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:www-data /usr/share/webapps/zabbix/&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now be able to browse to the Zabbix frontend: &amp;lt;nowiki&amp;gt;http://yourservername/zabbix/&amp;lt;/nowiki&amp;gt; or in &amp;lt;nowiki&amp;gt;http://localhost/zabbix&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The login using: Login name: &#039;&#039;&#039;Admin&#039;&#039;&#039; Password:&#039;&#039;&#039;zabbix&#039;&#039;&#039;. (as described at https://www.zabbix.com/documentation/4.0/manual/installation)&lt;br /&gt;
&lt;br /&gt;
There&#039;s no need to web setup cos we made all in cli as best hackers admins.&lt;br /&gt;
&lt;br /&gt;
== Zabbix tools for items maps or scripts ==&lt;br /&gt;
&lt;br /&gt;
There&#039;s no complete features in busybox so need more tools, also, Zabbix requires special permissions to use tools&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add bash fping tcptraceroute coreutils net-snmp-tools nmap perl rrdtool font-dejavu net-snmp-libs&lt;br /&gt;
&lt;br /&gt;
chown root:zabbix /usr/sbin/fping&lt;br /&gt;
&lt;br /&gt;
chmod u+s /usr/bin/ping&lt;br /&gt;
&lt;br /&gt;
chmod u+s /bin/ping&lt;br /&gt;
&lt;br /&gt;
chmod u+s /usr/bin/nmap &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|this is preferable to use sudo, that has more issues in security holes, so set ui bit is a security mess buyt less than the crap usage or &amp;quot;sudo&amp;quot;, cos these tools are need to run as root to right usage}}&lt;br /&gt;
&lt;br /&gt;
= Zabbix and the Monitored host =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Zabbix can monitor almost any device system&#039;&#039;&#039;, including Alpine Linux hosts, home computers, celphones, network devices, etc.&lt;br /&gt;
&lt;br /&gt;
== types of monitoring ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;zabbix agent&#039;&#039;&#039; is a zabbix service that runs on computers and is fully feartured, the &#039;&#039;&#039;SNMP(Simple Network Manager Protocol)&#039;&#039;&#039; is a common standard protocol and is the second most supported, the &#039;&#039;&#039;ICMP(Internet Control Message Protocol)&#039;&#039;&#039; is the most used and simples way but most limited, check the features:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Feature !! By Agent !! By SNMP !! By ICMP&lt;br /&gt;
|-&lt;br /&gt;
| Ping to check alive (direct ip) || Yes || Yes but with zabbbix proxy if firewall || Only on direct ip, no firewall&lt;br /&gt;
|-&lt;br /&gt;
| Retreive data from programs (direct ping) || Yes || Yes but with zabbbix proxy if firewall  || No&lt;br /&gt;
|-&lt;br /&gt;
| Send commands to manage || Yes || Yes but using zabbix proxy if firewall || No&lt;br /&gt;
|-&lt;br /&gt;
| Runs on any device || No, only computers || Mostly any network device || Yes&lt;br /&gt;
|-&lt;br /&gt;
| Runs on any OS || YEs, limited in androita and mainframes || Yes || Yes&lt;br /&gt;
|-&lt;br /&gt;
| Requires provilegies || Not necesary for most fearures || It depends || No&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Note|Support to allow zabbix-agentd to view running processes on Alpine Linux has been added since linux-grsec-2.6.35.9-r2. Please ensure you have that kernel installed prior to attempting to run zabbix-agentd.}}&lt;br /&gt;
&lt;br /&gt;
Ensure that the readproc group exists (support added since alpine-baselayout-2.0_rc1-r1), by adding the following line to /etc/group:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|readproc:x:30:zabbix}}&lt;br /&gt;
&lt;br /&gt;
== Monitoring by Zabbix Agents ==&lt;br /&gt;
&lt;br /&gt;
The agent way to monitoring is the most complete featured, but only applies to computers host, becouse the zabbiz-agent software is only available for those devices, for networking devices you must use ICMP or SNMP (check next subsection).&lt;br /&gt;
&lt;br /&gt;
So, install the agent package and configure it on each host to be monitored/managed (on server too):&lt;br /&gt;
&lt;br /&gt;
{{Note|Remenber that the hostname of the server is &amp;lt;nowiki&amp;gt;monitor.zabbixnetwork&amp;lt;/nowiki&amp;gt;, you can use the ip address too, but this name must be the same in the config files for active or passive servers, the web ui configured hostname server and/or zabbix configured hostname proxy server.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
https://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
https://dl-4.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add zabbix-agent net-snmp-libs net-snmp-agent-libs&lt;br /&gt;
&lt;br /&gt;
sed -i &#039;s|.*ListenPort.*=.*|ListenPort=10050|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|.*Hostname=.*|Hostname=monitordhost1|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|Server =.*|Server=localhost,monitor.zabbixnetwork|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|ServerActive.*=.*|ServerActive=localhost,monitor.zabbixnetwork |g&#039; /etc/zabbix/zabbix_agentd.conf|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|.*EnableRemoteCommands.*=.*|EnableRemoteCommands=1|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|.*LogRemoteCommands.*=.*|LogRemoteCommands=1|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|# Include=.*|Include=/etc/zabbix/zabbix_agentd.d/*.conf|&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add zabbix-agentd default&lt;br /&gt;
&lt;br /&gt;
rc-service zabbix-agentd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|The configured hostname in agent here is &amp;lt;nowiki&amp;gt;monitordhost1&amp;lt;/nowiki&amp;gt;, you can use the ip address too, but this name must be the same in the config files for active or passive host configured in the web ui, if the agent way will be used.}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|The &#039;&#039;&#039;zabbix service DB user is &amp;lt;code&amp;gt;zabbixdb&amp;lt;/code&amp;gt; and NOT &amp;lt;code&amp;gt;zabbix&amp;lt;/code&amp;gt;&#039;&#039;&#039;, the user &amp;lt;code&amp;gt;zabbixdb&amp;lt;/code&amp;gt; whatever you use postgresql or mysql, will not be used with password for agent monitoring, cos in postgresql will use the &amp;lt;code&amp;gt;ident&amp;lt;/code&amp;gt; way autentication, and in mysql will use the &amp;lt;code&amp;gt;socket&amp;lt;/code&amp;gt; way autentication: &#039;&#039;&#039;this makes sense cos user agent is &amp;lt;code&amp;gt;zabbix&amp;lt;/code&amp;gt; and does not have home.&#039;&#039;&#039; This is the correct and most secure way.}}&lt;br /&gt;
&lt;br /&gt;
== Monitor by SNMP protocol ==&lt;br /&gt;
&lt;br /&gt;
Then in each monitor system, you shoul define a community word due ISP&#039;s always will punish if you used &amp;lt;code&amp;gt;public&amp;lt;/code&amp;gt; and open SNMP to world, inclusivelly you shoul protect inside your private network too, so on each host to be monitored you shoul made those commands to configure SNMP (including the zabbix server) using the &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add net-snmp net-snmp-perl net-snmp-tools&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/snmp/snmpd.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
view systemonly included .1.3.6.1.2.1.1&lt;br /&gt;
view systemonly included .1.3.6.1.2.1.25.1&lt;br /&gt;
rocommunity  monitor&lt;br /&gt;
rocommunity  public localhost&lt;br /&gt;
rocommunity  public default -V systemonly&lt;br /&gt;
sysLocation    client host at monitor.zabbixnetwork&lt;br /&gt;
sysContact     infoadmin &amp;lt;venenux@venenux.net&amp;gt;&lt;br /&gt;
sysServices    72&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-update add snmpd default&lt;br /&gt;
&lt;br /&gt;
rc-service snmpd restart &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will allow to any host consult SNMP v2c with word &amp;quot;monitor&amp;quot;, but is best you use if have distributed network a SNMP v3 autentiated. &lt;br /&gt;
&lt;br /&gt;
{{Warning|So in zabbix web ui you must use &amp;quot;monitor&amp;quot; in the community word.}}&lt;br /&gt;
&lt;br /&gt;
== DB monitoring ==&lt;br /&gt;
&lt;br /&gt;
Due limitations any host server that will have and database, must have and agent aither have behind or not have direct zabbix server/proxy connection.&lt;br /&gt;
&lt;br /&gt;
In this case we used Mysql as example&lt;br /&gt;
&lt;br /&gt;
=== on the monitored side: DBMS server to monitor ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add zabbix-agent&lt;br /&gt;
&lt;br /&gt;
sed -i &#039;s|.*ListenPort.*=.*|ListenPort=10050|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|.*Hostname=.*|Hostname=theDBserver|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|Server =.*|Server=monitor.zabbixnetwork|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|ServerActive.*=.*|ServerActive=monitor.zabbixnetwork|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|.*EnableRemoteCommands.*=.*|EnableRemoteCommands=1|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|.*LogRemoteCommands.*=.*|LogRemoteCommands=1|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
sed -i &#039;s|# Include=|Include=/etc/zabbix/zabbix_agentd.d/*.conf|g&#039; /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add zabbix-agentd default&lt;br /&gt;
&lt;br /&gt;
rc-service zabbix-agentd restart&lt;br /&gt;
&lt;br /&gt;
apk add mariadb-client &lt;br /&gt;
&lt;br /&gt;
wget -O /etc/zabbix/zabbix-agent/userparameter_mysql.conf &amp;quot;https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/conf/zabbix_agentd/userparameter_mysql.conf?at=release/5.0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -e &amp;quot;CREATE USER &#039;zabbix&#039;@&#039;localhost&#039; IDENTIFIED VIA mysql_native_password USING PASSWORD(&#039;zabbix.db.1.com.1&#039;);&amp;quot;&lt;br /&gt;
mysql -u root -e &amp;quot;GRANT USAGE,REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO &#039;zabbix&#039;@&#039;localhost&#039;;&amp;quot;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|The configured hostname in agent here is &amp;lt;nowiki&amp;gt;theDBserver&amp;lt;/nowiki&amp;gt;, you can use the ip address too, but this name must be the same in the config files for active or passive host configured in the web ui, if the agent way will be used to monitor this server host.}}&lt;br /&gt;
&lt;br /&gt;
{{Warning|An new issue of missing files is on alpine zabbix packages so read [https://gitlab.alpinelinux.org/alpine/aports/-/issues/12791 &amp;lt;nowiki&amp;gt;https://gitlab.alpinelinux.org/alpine/aports/-/issues/12791&amp;lt;/nowiki&amp;gt;], for files that you could download manually}}&lt;br /&gt;
&lt;br /&gt;
=== on the zabbix server side: to configure the monitored host ===&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;template DB mysql&#039;&#039; o &#039;&#039;DB postgresql&#039;&#039; on the configured host and remenber that hostname in the configured host must be the same in the hostname configured in the agent configuration file of the monitored host.&lt;br /&gt;
&lt;br /&gt;
For most details check the next section crash course:&lt;br /&gt;
&lt;br /&gt;
= Optional: Crash course in adding hosts, checks, and notifications =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note:&#039;&#039; This is optional since it&#039;s not specific to Alpine Linux, but I wanted a couple notes for how to perform a simple check on a server that doesn&#039;t have the agent installed on it, and be notified on state changes.&lt;br /&gt;
&lt;br /&gt;
Administration -&amp;gt; Media Types -&amp;gt; Email&lt;br /&gt;
* Setup server, helo, email from address&lt;br /&gt;
&lt;br /&gt;
Administration -&amp;gt; Users&lt;br /&gt;
* Setup each user who&#039;ll get notified, make sure they have media type &amp;quot;Email&amp;quot; added with their address&lt;br /&gt;
&lt;br /&gt;
Configuration -&amp;gt; Hosts -&amp;gt; Create host&lt;br /&gt;
* In Linux Servers hostgroup&lt;br /&gt;
* Define dns name, ip, connect by IP&lt;br /&gt;
* If the machine is a simple networking device that will only be monitored using SNMP, add it to Template_SNMPv2_Device, and you&#039;re done.&lt;br /&gt;
&lt;br /&gt;
Configuration -&amp;gt; Templates -&amp;gt; Create template&lt;br /&gt;
* Give it a name (Template_Alpine_Linux_Infra_HTTP)&lt;br /&gt;
* In Templates group&lt;br /&gt;
&lt;br /&gt;
Configuration -&amp;gt; Templates -&amp;gt; Template_Alpine_Linux_Infra_HTTP -&amp;gt; Items&lt;br /&gt;
* Create Item&lt;br /&gt;
* Host: Template_Alpine_Linux_Infra_HTTP&lt;br /&gt;
* Description: HTTP Basic Check&lt;br /&gt;
* Type: Simple_check&lt;br /&gt;
* Key: http,80&lt;br /&gt;
&lt;br /&gt;
Configuration -&amp;gt; Templates -&amp;gt; Template_Alpine_Linux_Infra_HTTP -&amp;gt; Triggers&lt;br /&gt;
* Create Trigger&lt;br /&gt;
* Name: &amp;quot;HTTP Trigger&amp;quot;&lt;br /&gt;
* Expression: {Template_Alpine_Linux_Infra_HTTP:http,80.last(0)}#1&lt;br /&gt;
* Severity: High&lt;br /&gt;
&lt;br /&gt;
Configuration -&amp;gt; Actions -&amp;gt; &lt;br /&gt;
* Create Action&lt;br /&gt;
* name: Email notifications&lt;br /&gt;
* Event source: triggers&lt;br /&gt;
* Default Subject: add &amp;quot;{HOST.DNS}:&amp;quot; to the beginning&lt;br /&gt;
* Default message: add &amp;quot;{HOST.DNS}:&amp;quot; to the beginning&lt;br /&gt;
* Conditions: make host have to be from &amp;quot;Linux Servers&amp;quot; hostgroup, and Template_Alpine_Linux_Infra_HTTP:HTTP trigger&amp;quot; is not 1&lt;br /&gt;
* Email affected users&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Cacti:_traffic_analysis_and_monitoring_network]]&lt;br /&gt;
&lt;br /&gt;
== External resources and complete guides ==&lt;br /&gt;
&lt;br /&gt;
* [https://qgqlochekone.blogspot.com/search/?q=zabbix Complete alpine documentation on englilsh for zabbix curse]&lt;br /&gt;
* [https://vegnuli.wordpress.com/?s=zabbix Complete alpine documentation on spanish for zabbix curse]&lt;br /&gt;
&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:PHP]]&lt;br /&gt;
[[Category:SQL]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Converting_mediawiki_database_from_postgresql_to_mysql/mariadb&amp;diff=29251</id>
		<title>Converting mediawiki database from postgresql to mysql/mariadb</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Converting_mediawiki_database_from_postgresql_to_mysql/mariadb&amp;diff=29251"/>
		<updated>2025-03-11T23:35:30Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Why to use mysql/mariadb instead of postgresql? */ clarify Wikipedia uses MariaDB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Why to use mysql/mariadb instead of postgresql?==&lt;br /&gt;
&lt;br /&gt;
Here is what [[MediaWiki]] says [[https://www.mediawiki.org/wiki/Manual:PostgreSQL]]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;Most of the common maintenance scripts work with PostgreSQL however some of the more obscure ones might have problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Is PostgreSQL a good choice for MediaWiki?&amp;lt;br&amp;gt;&lt;br /&gt;
Wikipedia uses MariaDB so MediaWiki gets more testing on MariaDB than PostgreSQL. While support for PostgreSQL is maintained by volunteers, most core functionality is working.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Challenge==&lt;br /&gt;
====Why not to use dumpBackup.php script in mediawiki? [[https://www.mediawiki.org/wiki/Manual:DumpBackup.php]]====&lt;br /&gt;
If you need to save only mediawiki data and pages modify history then the best and easiest way probably would be:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;php maintenance/dumpBackup.php --full --include-files --uploads &amp;gt; /tmp/wiki.xml&lt;br /&gt;
php maintenance/importDump.php /tmp/wiki.xml&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
However user accounts, user contrubutions, logs, etc will not be migrated this way.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Why not to use tools for converting postgresql databases to mysql?====&lt;br /&gt;
Mediawiki postgresql version is quite different from mysql version. For example: some table names are different, field order, timestamp format (pg: &#039;2015-11-01 08:42:31+00&#039;, mysql: &#039;20151101084231&#039;), many fields that are NULL in postgresql are not allowed to be NULL in mysql. That is why there will be issues when dumping data from postgresql and importing it to mysql.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
There is a script mentioned in https://www.winterrodeln.org/trac/wiki/MediaWikiPostgresqlToMysql that should be converting postgresql database to mysql. However in my case it did not work because of the issues mentioned above (that script was written in 2009-01-16).&lt;br /&gt;
&lt;br /&gt;
==Mediawiki location==&lt;br /&gt;
In this example mediawiki files root is located in &#039;&#039;&#039;/var/www/wiki.wikiname.org/htdocs/w&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Web server is &#039;&#039;&#039;lighttpd&#039;&#039;&#039;. /etc/lighttpd/lighttpd.conf contains lines:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;simple-vhost.server-root = &amp;quot;/var/www&amp;quot;&lt;br /&gt;
simple-vhost.default-host = &amp;quot;wiki.wikiname.org&amp;quot;&lt;br /&gt;
simple-vhost.document-root = &amp;quot;/htdocs/&amp;quot;&lt;br /&gt;
url.rewrite-once = (&lt;br /&gt;
&amp;quot;^/wiki/([^?]*)(?:\?(.*))?&amp;quot; =&amp;gt; &amp;quot;/w/index.php?title=$1&amp;amp;$2&amp;quot;,&lt;br /&gt;
    &amp;quot;^/wiki&amp;quot; =&amp;gt; &amp;quot;/w/index.php&amp;quot;,&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Disallowing editing mediawiki until database is converted==&lt;br /&gt;
{{Cmd|vi /var/www/wiki.wikiname.org/htdocs/w/LocalSettings.php}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;$wgReadOnly = &#039;This wiki is currently being upgraded to a newer software version.&#039;;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Preparing dump files for importing data to mysql==&lt;br /&gt;
====Making postgresql dump====&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;su - postgres&lt;br /&gt;
	pg_dump wikidb &amp;gt; /tmp/wikidb-pg.dump&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Making temporary postgresql database looking like mysql====&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;su - postgres&lt;br /&gt;
	echo &amp;quot;CREATE DATABASE tmpdb ENCODING &#039;SQL_ASCII&#039; LC_COLLATE=&#039;C&#039; LC_CTYPE=&#039;C&#039; TEMPLATE=template0;&amp;quot; | psql&lt;br /&gt;
	psql tmpdb &amp;lt; /tmp/wikidb-pg.dump&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====SQL script modifying postgresql database====&lt;br /&gt;
For avoiding issues when importing data to mysql we need to modify mediawiki postgresql database so that it would look like mediawiki mysql database. Basically the script will make field order in pg tables like in mysql and will set non-NULL values to the fields that are not allowed to be NULL in mysql&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;/tmp/pg-prepare-for-mysql.sql&#039;&#039;&#039;&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;/* archive */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select ar_id, ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text, ar_timestamp, ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, ar_deleted, ar_len, ar_page_id, ar_parent_id, ar_sha1, ar_content_model, ar_content_format FROM archive;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set ar_text = &#039;&#039; where ar_text is NULL;&lt;br /&gt;
update tmp_table set ar_comment = &#039;&#039; where ar_comment is NULL;&lt;br /&gt;
update tmp_table set ar_user = 0 where ar_user is NULL;&lt;br /&gt;
update tmp_table set ar_flags = &#039;&#039; where ar_flags is NULL;&lt;br /&gt;
ALTER TABLE archive RENAME TO orig_archive;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO archive;&lt;br /&gt;
&lt;br /&gt;
/* category */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select cat_id, cat_title, cat_pages, cat_subcats, cat_files FROM category;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE category RENAME TO orig_category;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO category;&lt;br /&gt;
&lt;br /&gt;
/* categorylinks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type FROM categorylinks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set cl_sortkey = &#039;&#039; where cl_sortkey is NULL;&lt;br /&gt;
ALTER TABLE categorylinks RENAME TO orig_categorylinks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO categorylinks;&lt;br /&gt;
&lt;br /&gt;
/* change_tag (OK) */&lt;br /&gt;
&lt;br /&gt;
/* externallinks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select el_id, el_from, el_to, el_index FROM externallinks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE externallinks RENAME TO orig_externallinks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO externallinks;&lt;br /&gt;
&lt;br /&gt;
/* filearchive (OK) */&lt;br /&gt;
&lt;br /&gt;
/* image */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select img_name, img_size, img_width, img_height, img_metadata, img_bits, img_media_type, img_major_mime, img_minor_mime, img_description, img_user, img_user_text, img_timestamp, img_sha1 FROM image;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set img_bits = 0 where img_bits is NULL;&lt;br /&gt;
update tmp_table set img_major_mime = &#039;&#039; where img_major_mime is NULL;&lt;br /&gt;
update tmp_table set img_minor_mime = &#039;&#039; where img_minor_mime is NULL;&lt;br /&gt;
ALTER TABLE image RENAME TO orig_image;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO image;&lt;br /&gt;
&lt;br /&gt;
/* imagelinks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select il_from, il_from_namespace, il_to FROM imagelinks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE imagelinks RENAME TO orig_imagelinks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO imagelinks;&lt;br /&gt;
&lt;br /&gt;
/* interwiki */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select iw_prefix, iw_url, iw_api, iw_wikiid, iw_local, iw_trans FROM interwiki;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE interwiki RENAME TO orig_interwiki;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO interwiki;&lt;br /&gt;
&lt;br /&gt;
/* ipblocks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select ipb_id, ipb_address, ipb_user, ipb_by, ipb_by_text, ipb_reason, ipb_timestamp, ipb_auto, ipb_anon_only, ipb_create_account, ipb_enable_autoblock, ipb_expiry, ipb_range_start, ipb_range_end, ipb_deleted, ipb_block_email, ipb_allow_usertalk, ipb_parent_block_id FROM ipblocks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set ipb_address = &#039;&#039; where ipb_address is NULL;&lt;br /&gt;
update tmp_table set ipb_user = 0 where ipb_user is NULL;&lt;br /&gt;
update tmp_table set ipb_range_start = &#039;&#039; where ipb_range_start is NULL;&lt;br /&gt;
update tmp_table set ipb_range_end = &#039;&#039; where ipb_range_end is NULL;&lt;br /&gt;
ALTER TABLE ipblocks RENAME TO orig_ipblocks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO ipblocks;&lt;br /&gt;
&lt;br /&gt;
/* iwlinks (OK) */&lt;br /&gt;
&lt;br /&gt;
/* job */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select job_id, job_cmd, job_namespace, job_title, job_timestamp, job_params, job_random, job_attempts, job_token, job_token_timestamp, job_sha1 FROM job;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE job RENAME TO orig_job;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO job;&lt;br /&gt;
&lt;br /&gt;
/* l10n_cache (OK) */&lt;br /&gt;
&lt;br /&gt;
/* langlinks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select ll_from, ll_lang, ll_title FROM langlinks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set ll_lang = &#039;&#039; where ll_lang is NULL;&lt;br /&gt;
update tmp_table set ll_title = &#039;&#039; where ll_title is NULL;&lt;br /&gt;
ALTER TABLE langlinks RENAME TO orig_langlinks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO langlinks;&lt;br /&gt;
&lt;br /&gt;
/* logging */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select log_id, log_type, log_action, log_timestamp, log_user, log_user_text, log_namespace, log_title, log_page, log_comment, log_params, log_deleted FROM logging;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set log_user = 0 where log_user is NULL;&lt;br /&gt;
update tmp_table set log_comment = &#039;&#039; where log_comment is NULL;&lt;br /&gt;
update tmp_table set log_params = &#039;&#039; where log_params is NULL;&lt;br /&gt;
ALTER TABLE logging RENAME TO orig_logging;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO logging;&lt;br /&gt;
&lt;br /&gt;
/* log_search (OK) */&lt;br /&gt;
&lt;br /&gt;
/* module_deps (OK) */&lt;br /&gt;
&lt;br /&gt;
/* msg_resource (OK) */&lt;br /&gt;
&lt;br /&gt;
/* msg_resource_links (OK) */&lt;br /&gt;
&lt;br /&gt;
/* objectcache */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select keyname, value, exptime FROM objectcache;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set keyname = &#039;&#039; where keyname is NULL;&lt;br /&gt;
ALTER TABLE objectcache RENAME TO orig_objectcache;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO objectcache;&lt;br /&gt;
&lt;br /&gt;
/* oldimage */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select oi_name, oi_archive_name, oi_size, oi_width, oi_height, oi_bits, oi_description, oi_user, oi_user_text, oi_timestamp, oi_metadata, oi_media_type, oi_major_mime, oi_minor_mime, oi_deleted, oi_sha1 FROM oldimage;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set oi_bits = 0 where oi_bits is NULL;&lt;br /&gt;
update tmp_table set oi_description = &#039;&#039; where oi_description is NULL;&lt;br /&gt;
update tmp_table set oi_user = 0 where oi_user is NULL;&lt;br /&gt;
update tmp_table set oi_major_mime = &#039;&#039; where oi_major_mime is NULL;&lt;br /&gt;
update tmp_table set oi_minor_mime = &#039;&#039; where oi_minor_mime is NULL;&lt;br /&gt;
ALTER TABLE oldimage RENAME TO orig_oldimage;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO oldimage;&lt;br /&gt;
&lt;br /&gt;
/* page */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select page_id, page_namespace, page_title, page_restrictions, page_is_redirect, page_is_new, page_random, page_touched, page_links_updated, page_latest, page_len, page_content_model, page_lang FROM page;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set page_restrictions = &#039;&#039; where page_restrictions is NULL;&lt;br /&gt;
/*update tmp_table set page_touched = &#039;&#039; where page_touched is NULL;*/&lt;br /&gt;
ALTER TABLE page RENAME TO orig_page;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO page;&lt;br /&gt;
&lt;br /&gt;
/* pagelinks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select pl_from, pl_from_namespace, pl_namespace, pl_title FROM pagelinks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE pagelinks RENAME TO orig_pagelinks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO pagelinks;&lt;br /&gt;
&lt;br /&gt;
/* page_props (OK) */&lt;br /&gt;
&lt;br /&gt;
/* page_restrictions */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select pr_id, pr_page, pr_type, pr_level, pr_cascade, pr_user, pr_expiry FROM page_restrictions;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE page_restrictions RENAME TO orig_page_restrictions;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO page_restrictions;&lt;br /&gt;
&lt;br /&gt;
/* protected_titles */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select pt_namespace, pt_title, pt_user, pt_reason, pt_timestamp, pt_expiry, pt_create_perm FROM protected_titles;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set pt_user = 0 where pt_user is NULL;&lt;br /&gt;
/*update tmp_table set pt_expiry = &#039;&#039; where pt_expiry is NULL;*/&lt;br /&gt;
ALTER TABLE protected_titles RENAME TO orig_protected_titles;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO protected_titles;&lt;br /&gt;
&lt;br /&gt;
/* querycache (OK) */&lt;br /&gt;
&lt;br /&gt;
/* querycachetwo (OK) */&lt;br /&gt;
&lt;br /&gt;
/* querycache_info */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select qci_type, qci_timestamp FROM querycache_info;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set qci_type = &#039;&#039; where qci_type is NULL;&lt;br /&gt;
/* update tmp_table set qci_timestamp = &#039;&#039; where qci_timestamp is NULL; */&lt;br /&gt;
ALTER TABLE querycache_info RENAME TO orig_querycache_info;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO querycache_info;&lt;br /&gt;
&lt;br /&gt;
/* recentchanges (rc_cur_time was removed in 1.24wmf6) */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select rc_id, rc_timestamp, rc_user, rc_user_text, rc_namespace, rc_title, rc_comment, rc_minor, rc_bot, rc_new, rc_cur_id, rc_this_oldid, rc_last_oldid, rc_type, rc_source, rc_patrolled, rc_ip, rc_old_len, rc_new_len, rc_deleted, rc_logid, rc_log_type, rc_log_action, rc_params FROM recentchanges;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set rc_user = 0 where rc_user is NULL;&lt;br /&gt;
update tmp_table set rc_comment = &#039;&#039; where rc_comment is NULL;&lt;br /&gt;
update tmp_table set rc_cur_id = 0 where rc_cur_id is NULL;&lt;br /&gt;
/* update tmp_table set rc_ip = &#039;&#039; where rc_ip is NULL; */&lt;br /&gt;
ALTER TABLE recentchanges RENAME TO orig_recentchanges;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO recentchanges;&lt;br /&gt;
&lt;br /&gt;
/* redirect (OK) */&lt;br /&gt;
&lt;br /&gt;
/* revision */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select rev_id, rev_page, rev_text_id, rev_comment, rev_user, rev_user_text, rev_timestamp, rev_minor_edit, rev_deleted, rev_len, rev_parent_id, rev_sha1, rev_content_model, rev_content_format FROM revision;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set rev_page = 0 where rev_page is NULL;&lt;br /&gt;
update tmp_table set rev_text_id = 0 where rev_text_id is NULL;&lt;br /&gt;
update tmp_table set rev_comment = &#039;&#039; where rev_comment is NULL;&lt;br /&gt;
ALTER TABLE revision RENAME TO orig_revision;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO revision;&lt;br /&gt;
&lt;br /&gt;
/* searchindex (does not exists in pg) */&lt;br /&gt;
&lt;br /&gt;
/* sites (OK) */&lt;br /&gt;
&lt;br /&gt;
/* site_identifiers (OK) */&lt;br /&gt;
&lt;br /&gt;
/* site_stats */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select ss_row_id, ss_total_edits, ss_good_articles, ss_total_pages, ss_users, ss_active_users, ss_images FROM site_stats;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE site_stats RENAME TO orig_site_stats;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO site_stats;&lt;br /&gt;
&lt;br /&gt;
/* tag_summary (OK) */&lt;br /&gt;
&lt;br /&gt;
/* templatelinks */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select tl_from, tl_from_namespace, tl_namespace, tl_title FROM templatelinks;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
ALTER TABLE templatelinks RENAME TO orig_templatelinks;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO templatelinks;&lt;br /&gt;
&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select old_id, old_text, old_flags FROM pagecontent;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set old_text = &#039;&#039; where old_text is NULL;&lt;br /&gt;
update tmp_table set old_flags = &#039;&#039; where old_flags is NULL;&lt;br /&gt;
ALTER TABLE pagecontent RENAME TO orig_pagecontent;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO pagecontent;&lt;br /&gt;
&lt;br /&gt;
/* transcache (OK) */&lt;br /&gt;
&lt;br /&gt;
/* updatelog (OK) */&lt;br /&gt;
&lt;br /&gt;
/* uploadstash */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select us_id, us_user, us_key, us_orig_path, us_path, us_source_type, us_timestamp, us_status, us_chunk_inx, us_props, us_size, us_sha1, us_mime, us_media_type, us_image_width, us_image_height, us_image_bits FROM uploadstash;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set us_user = 0 where us_user is NULL;&lt;br /&gt;
update tmp_table set us_key = &#039;&#039; where us_key is NULL;&lt;br /&gt;
update tmp_table set us_orig_path = &#039;&#039; where us_orig_path is NULL;&lt;br /&gt;
update tmp_table set us_path = &#039;&#039; where us_path is NULL;&lt;br /&gt;
/* update tmp_table set us_timestamp = &#039;&#039; where us_timestamp is NULL; */&lt;br /&gt;
update tmp_table set us_status = &#039;&#039; where us_status is NULL;&lt;br /&gt;
update tmp_table set us_size = 0 where us_size is NULL;&lt;br /&gt;
update tmp_table set us_sha1 = &#039;&#039; where us_sha1 is NULL;&lt;br /&gt;
ALTER TABLE uploadstash RENAME TO orig_uploadstash;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO uploadstash;&lt;br /&gt;
&lt;br /&gt;
/* user (in pg it is named mwuser)*/&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select user_id, user_name, user_real_name, user_password, user_newpassword, user_newpass_time, user_email, user_touched, user_token, user_email_authenticated, user_email_token, user_email_token_expires, user_registration, user_editcount, user_password_expires FROM mwuser;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set user_real_name = &#039;&#039; where user_real_name is NULL;&lt;br /&gt;
update tmp_table set user_password = &#039;&#039; where user_password is NULL;&lt;br /&gt;
update tmp_table set user_newpassword = &#039;&#039; where user_newpassword is NULL;&lt;br /&gt;
update tmp_table set user_token = &#039;&#039; where user_token is NULL;&lt;br /&gt;
update tmp_table set user_email = &#039;&#039; where user_email is NULL;&lt;br /&gt;
/* update tmp_table set user_touched = &#039;&#039; where user_touched is NULL; */&lt;br /&gt;
delete from tmp_table where user_id = 0;&lt;br /&gt;
ALTER TABLE mwuser RENAME TO orig_mwuser;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO mwuser;&lt;br /&gt;
/* it cannot be named &#039;user&#039;, like in mysql */&lt;br /&gt;
&lt;br /&gt;
/* user_former_groups */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select ufg_user, ufg_group FROM user_former_groups;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set ufg_user = 0 where ufg_user is NULL;&lt;br /&gt;
ALTER TABLE user_former_groups RENAME TO orig_user_former_groups;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO user_former_groups;&lt;br /&gt;
&lt;br /&gt;
/* user_groups */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select ug_user, ug_group FROM user_groups;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set ug_user = 0 where ug_user is NULL;&lt;br /&gt;
ALTER TABLE user_groups RENAME TO orig_user_groups;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO user_groups;&lt;br /&gt;
&lt;br /&gt;
/* user_newtalk */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select user_id, user_ip, user_last_timestamp FROM user_newtalk;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set user_ip = &#039;&#039; where user_ip is NULL;&lt;br /&gt;
ALTER TABLE user_newtalk RENAME TO orig_user_newtalk;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO user_newtalk;&lt;br /&gt;
&lt;br /&gt;
/* user_properties */&lt;br /&gt;
CREATE VIEW tmp_view AS&lt;br /&gt;
 select up_user, up_property, up_value FROM user_properties;&lt;br /&gt;
SELECT * INTO tmp_table FROM tmp_view;&lt;br /&gt;
DROP VIEW tmp_view;&lt;br /&gt;
update tmp_table set up_user = 0 where up_user is NULL;&lt;br /&gt;
ALTER TABLE user_properties RENAME TO orig_user_properties;&lt;br /&gt;
ALTER TABLE tmp_table RENAME TO user_properties;&lt;br /&gt;
&lt;br /&gt;
/* valid_tag (OK) */&lt;br /&gt;
&lt;br /&gt;
/* watchlist (OK) */&lt;br /&gt;
&lt;br /&gt;
/* external_user (not needed) */&lt;br /&gt;
ALTER TABLE external_user RENAME TO orig_external_user;&lt;br /&gt;
&lt;br /&gt;
/* hitcounter (removed in MediaWiki 1.25) */&lt;br /&gt;
ALTER TABLE hitcounter RENAME TO orig_hitcounter;&lt;br /&gt;
&lt;br /&gt;
/* mediawiki_version  (&#039;Nobody actually uses it anymore, it just gets silently updated (and only for Postgres at that)&#039;) */&lt;br /&gt;
ALTER TABLE mediawiki_version RENAME TO orig_mediawiki_version;&lt;br /&gt;
&lt;br /&gt;
/* profiling (&#039;It&#039;s only used in an obscure debugging mode.&#039;) */&lt;br /&gt;
ALTER TABLE profiling RENAME TO orig_profiling;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/* trackbacks (This feature was removed completely in version MediaWiki 1.19.) */&lt;br /&gt;
ALTER TABLE trackbacks RENAME TO orig_trackbacks;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;su - postgres&lt;br /&gt;
	psql tmpdb &amp;lt; /tmp/pg-prepare-for-mysql.sql&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Making dump files for mysql import====&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;su - postgres&lt;br /&gt;
	mkdir /tmp/wikidb-pg-dump&lt;br /&gt;
	psql -d wikidb -c &amp;quot;SELECT table_schema || &#039;.&#039; || table_name FROM information_schema.tables WHERE table_type = &#039;BASE TABLE&#039; AND table_schema NOT IN (&#039;pg_catalog&#039;, &#039;information_schema&#039;);&amp;quot; &amp;gt; /tmp/t&lt;br /&gt;
	cat /tmp/t | grep mediawiki | sed &#039;s/ mediawiki.//g&#039; | sort &amp;gt; /tmp/pg-tables.txt&lt;br /&gt;
&lt;br /&gt;
	for t in `cat /tmp/pg-tables.txt`; do echo &amp;quot;dumping $t&amp;quot;; pg_dump -d tmpdb --data-only --inserts -t mediawiki.$t &amp;gt; /tmp/wikidb-pg-dump/$t.sql; done&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Modifying dump files====&lt;br /&gt;
Postgresql specific sql should be removed&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cd /tmp/wikidb-pg-dump&lt;br /&gt;
for f in *.sql; do sed -i &#039;s/^SET statement_timeout = 0;$//g&#039; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &#039;s/^SET lock_timeout = 0;$//g&#039; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &amp;quot;s/^SET client_encoding = &#039;SQL_ASCII&#039;;$//g&amp;quot; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &#039;s/^SET standard_conforming_strings = on;$//g&#039; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &#039;s/^SET check_function_bodies = false;$//g&#039; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &#039;s/^SET client_min_messages = warning;$//g&#039; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &#039;s/^SET search_path = mediawiki, pg_catalog;$//g&#039; $f; done&lt;br /&gt;
for f in *.sql; do sed -i &amp;quot;s/^SELECT pg_catalog.setval(&#039;filearchive_fa_id_seq&#039;, 25, true);$//g&amp;quot; $f; done&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Postgresql table &#039;&#039;&#039;mwuser&#039;&#039;&#039; corresponds to mysql table &#039;&#039;&#039;user&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;for f in *.sql; do sed -i &amp;quot;s/^INSERT INTO mwuser VALUES/INSERT INTO user VALUES/g&amp;quot; $f; done&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Postgresql table &#039;&#039;&#039;pagecontent&#039;&#039;&#039; corresponds to mysql table &#039;&#039;&#039;text&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;for f in *.sql; do sed -i &amp;quot;s/^INSERT INTO pagecontent VALUES/INSERT INTO text VALUES/g&amp;quot; $f; done&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Back slashes should be replaced with double backslashes&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;for f in *.sql; do sed -i &#039;s/\\/\\\\/g&#039; $f; done&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Timestamp format in postgresql is different from mysql (pg: &#039;2015-10-31 10:10:10+00&#039;, mysql: &#039;20151031101010&#039;). All timestamps should be converted to avoid errors like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;... Language::sprintfDate: The timestamp should be a number&amp;lt;/code&amp;gt;&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;for f in *.sql; do sed -i &amp;quot;s/&#039;\([0-9][0-9][0-9][0-9]\)-\([0-9][0-9]\)-\([0-9][0-9]\) \([0-9][0-9]\):\([0-9][0-9]\):\([0-9][0-9]\)[+-][0-9][0-9]&#039;/&#039;\1\2\3\4\5\6&#039;/g&amp;quot; $f; done&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In postgresql &#039;&#039;&#039;ipblocks&#039;&#039;&#039; table may contain records with duplicated field &#039;&#039;&#039;ipb_address&#039;&#039;&#039;. mysql requires that ipb_address field is unique.&lt;br /&gt;
Check manually &#039;&#039;&#039;ipblocks.sql&#039;&#039;&#039; file. Delete records with duplicated field &#039;&#039;&#039;ipb_address&#039;&#039;&#039; to prevent errors like:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;# ERROR 1062 (23000) at line 152: Duplicate entry &#039;xxxxxx-0-0-0&#039; for key &#039;ipb_address&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
{{Cmd|vi ipblocks.sql}}&lt;br /&gt;
&lt;br /&gt;
==Changing mysql root password, creating user for mediawiki==&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;mysql -u root&lt;br /&gt;
	SET PASSWORD FOR &#039;root&#039;@&#039;localhost&#039; = PASSWORD(&#039;newpassword&#039;);&lt;br /&gt;
	SET PASSWORD FOR &#039;root&#039;@&#039;127.0.0.1&#039; = PASSWORD(&#039;newpassword&#039;);&lt;br /&gt;
	SET PASSWORD FOR &#039;root&#039;@&#039;::1&#039; = PASSWORD(&#039;newpassword&#039;);&lt;br /&gt;
	FLUSH PRIVILEGES;&lt;br /&gt;
	CREATE USER &#039;wikiuser&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;wikiuserpassword&#039;;&lt;br /&gt;
	GRANT ALL PRIVILEGES ON *.* TO &#039;wikiuser&#039;@&#039;localhost&#039; WITH GRANT OPTION;&lt;br /&gt;
	CREATE USER &#039;wikiuser&#039;@&#039;%&#039; IDENTIFIED BY &#039;wikiuserpassword&#039;;&lt;br /&gt;
	GRANT ALL PRIVILEGES ON *.* TO &#039;wikiuser&#039;@&#039;%&#039; WITH GRANT OPTION;&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Setting up new mediawiki==&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cd /var/www/wiki.wikiname.org/htdocs&lt;br /&gt;
wget https://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.3.tar.gz&lt;br /&gt;
tar zxf mediawiki-1.25.3.tar.gz&lt;br /&gt;
mv mediawiki-1.25.3 w&lt;br /&gt;
rm mediawiki-1.25.3.tar.gz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|vi index.php}}&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  header(&#039;Location: /wiki&#039;);&lt;br /&gt;
?&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open your wiki in browser &amp;lt;nowiki&amp;gt;https://wiki.wikiname.org&amp;lt;/nowiki&amp;gt;, go through setup process (DB type:mysql, engin: innodb, charset: binary)&amp;lt;br&amp;gt;&lt;br /&gt;
Compare LocalSettings.php file generated by setup process with old mediawiki LocalSettings.php file&amp;lt;br&amp;gt;&lt;br /&gt;
Take needed settings from old LocalSettings.php&amp;lt;br&amp;gt;&lt;br /&gt;
Copy new LocalSettings.php into mediawiki directory /var/www/wiki.wikiname.org/htdocs/w&amp;lt;br&amp;gt;&lt;br /&gt;
Copy needed files from old mediawiki (images/*, extensions/..., resources/...)&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cd /var/www/wiki.wikiname.org/htdocs/w&lt;br /&gt;
find . -type d &amp;gt; /tmp/d&lt;br /&gt;
while read d; do chmod 755 &amp;quot;$d&amp;quot;; done &amp;lt; /tmp/d&lt;br /&gt;
find . -type f &amp;gt; /tmp/f&lt;br /&gt;
while read f; do chmod 644 &amp;quot;$f&amp;quot;; done &amp;lt; /tmp/f&lt;br /&gt;
chown -R lighttpd:lighttpd .&lt;br /&gt;
cd /var/www/wiki.wikiname.org/htdocs/w&lt;br /&gt;
php maintenance/update.php # it will activate extensions and create needed tables in mysql db&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Clearing mysql tables before import==&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;mysql wikidb -uUSERNAME -pPASSWORD --default-character-set=utf8 -Bse &#039;show tables;&#039; &amp;gt; /tmp/t&lt;br /&gt;
for t in `cat /tmp/t`; do echo &amp;quot;TRUNCATE $t;&amp;quot;; done &amp;gt;/tmp/mysql-clear-tables.sql&lt;br /&gt;
mysql wikidb -uUSERNAME -pPASSWORD --default-character-set=utf8 &amp;lt; /tmp/mysql-clear-tables.sql&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Importing data into mysql==&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;for t in `cat /tmp/pg-tables.txt`; do echo &amp;quot;importing $t&amp;quot;; mysql wikidb -uUSERNAME -pPASSWORD --default-character-set=utf8 &amp;lt; /path/to/wikidb-pg-dump/$t.sql; done&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Running maintenance scripts==&lt;br /&gt;
{{Cmd|php maintenance/update.php&lt;br /&gt;
php maintenance/rebuildrecentchanges.php&lt;br /&gt;
php maintenance/rebuildtextindex.php&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Regenerating cache==&lt;br /&gt;
Old cache in &#039;&#039;&#039;l10n_cache&#039;&#039;&#039; table may couse problems. It can be deleted and regenerated again.&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;echo &amp;quot;TRUNCATE l10n_cache;&amp;quot; | mysql wikidb -uUSERNAME -pPASSWORD --default-character-set=utf8&lt;br /&gt;
cd /var/www/wiki.wikiname.org/htdocs/w&lt;br /&gt;
php maintenance/rebuildLocalisationCache.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[MariaDB]]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL&amp;diff=29250</id>
		<title>Production LAMP system: Lighttpd + PHP + MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL&amp;diff=29250"/>
		<updated>2025-03-11T23:34:00Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Configuration */ already default&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In production web, &#039;&#039;&#039;LAMP&#039;&#039;&#039; means &#039;&#039;&#039;L&#039;&#039;&#039;inux + &#039;&#039;&#039;A&#039;&#039;&#039;pache + &#039;&#039;&#039;M&#039;&#039;&#039;ysql + &#039;&#039;&#039;P&#039;&#039;&#039;hp installed and integrated, but today, more and more, &#039;&#039;Apache&#039;&#039; is being replaced by &#039;&#039;Nginx&#039;&#039; or &#039;&#039;Lighttpd&#039;&#039; and &#039;&#039;[[MySQL]]&#039;&#039; by &#039;&#039;[[MariaDB]]&#039;&#039;. The &#039;&#039;LAMP&#039;&#039; documents are:&lt;br /&gt;
&lt;br /&gt;
== 1. The web server: Lighttpd ==&lt;br /&gt;
&lt;br /&gt;
[https://www.lighttpd.net/ lighttpd] is a simple, standards-compliant, secure, and flexible web server, Nginx is the most used due to beeing manageable by ISP panel&#039;s software, but &#039;&#039;&#039;lighttpd performs better. Nginx cannot process fast-cgi programs&#039;&#039;&#039;. For more lighttpd information, consult the [[Production Web server: Lighttpd]] wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd Installation ===&lt;br /&gt;
&lt;br /&gt;
Production environment will handle only needed packages. So no doc or managers allowed:&lt;br /&gt;
&lt;br /&gt;
# run apk for needed packages&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add lighttpd gamin&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd pre php configuration ===&lt;br /&gt;
&lt;br /&gt;
# make the htdos public web root directories &lt;br /&gt;
# change default port to production one, http is used with 80&lt;br /&gt;
# use FAM style (gamin) file alteration monitor, increases performance &#039;&#039;&#039;ONLY ON 3.4 to 3.8 releases!!!&#039;&#039;&#039;&lt;br /&gt;
# use linux event handler, increases performance due Alpine are linux only&lt;br /&gt;
# added the service to the default runlevel, not to boot, because networking needs to be active first&lt;br /&gt;
# started the web server service&lt;br /&gt;
# Enable the mod_status at the config files&lt;br /&gt;
# change path in the config file, we are using security by obfuscation&lt;br /&gt;
# restart the service to see changes at the browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs/stats /var/log/lighttpd /var/lib/lighttpd&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*server.port.*=.*#server.port          = 80#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*server.event-handler = &amp;quot;linux-sysepoll&amp;quot;.*#server.event-handler = &amp;quot;linux-sysepoll&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/www/localhost/&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/lib/lighttpd&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/log/lighttpd&lt;br /&gt;
&lt;br /&gt;
rc-update add lighttpd default&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;it works&amp;quot; &amp;gt; /var/www/localhost/htdocs/index.html&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_status.*,.*#    &amp;quot;mod_status&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*status.status-url.*=.*#status.status-url  = &amp;quot;/stats/server-status&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*status.config-url.*=.*#status.config-url  = &amp;quot;/stats/server-config&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For testing, open a browser and go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;webserveripaddres&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You will see &amp;quot;it works&amp;quot;&#039;&#039;&#039;. The &amp;quot;webserveripaddres&amp;quot; is the ip address of your setup/server machine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;There&#039;s a problem in Alpine linux, FAM (gamin) is activated as a lighttpd only service&#039;&#039;&#039;, that makes sense in docker, but on a server, it could be a problem if FAM (gamin) is also needed for other services at the same time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OPTIONAL:&#039;&#039;&#039; alpine packagers are a mess, removed FAM on recent, so older releases of alpine can use compiled FAM packages with &amp;lt;code&amp;gt;sed -i -r &#039;s#.*server.stat-cache-engine.*=.*# server.stat-cache-engine = &amp;quot;fam&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 2. php scripting: PHP fpm ==&lt;br /&gt;
&lt;br /&gt;
In Alpine there are two main languages for programming dynamic web pages: PHP and LUA. Alpine is minimalist so not all PHP packages are need in most cases.&lt;br /&gt;
Both repositories must be enabled (main and community). Here we explain the most common use in production.&lt;br /&gt;
&lt;br /&gt;
=== PHP Installation ===&lt;br /&gt;
&lt;br /&gt;
{{Obsolete|Update to a newer or generic php version}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7 php7-bcmath php7-bz2 php7-ctype php7-curl php7-dom php7-enchant php7-exif php7-fpm php7-gd php7-gettext php7-gmp php7-iconv php7-imap php7-intl php7-json php7-mbstring php7-opcache php7-openssl php7-phar php7-posix php7-pspell php7-recode php7-session php7-simplexml php7-sockets php7-sysvmsg php7-sysvsem php7-sysvshm php7-tidy php7-xml php7-xmlreader php7-xmlrpc php7-xmlwriter php7-xsl php7-zip php7-sqlite3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;The packages below are only for specific situations. Install them only when needed (especially php-pear)&#039;&#039;&#039;, for example, &amp;lt;code&amp;gt;cacti&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cacti-php7&amp;lt;/code&amp;gt; depend on &amp;lt;code&amp;gt;php7&amp;lt;/code&amp;gt;, but you must install &#039;&#039;&#039;only&#039;&#039;&#039; the cacti package, all the dependencies must be previously installed from stable.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7-pgsql php7-mysqli php7-mysqlnd php7-snmp php7-soap php7-ldap php7-pcntl php7-pear php7-shmop php7-wddx php7-cgi php7-pdo php7-snmp php7-tokenizer &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;The packages below are only for database access using php in specific ways. Install them only if you need them (specially php--pdo ones)&#039;&#039;&#039;. For example, &amp;lt;code&amp;gt;cacti&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cacti-php7&amp;lt;/code&amp;gt; depend on &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt;, but you must install only the cacti package, all the dependencies like &amp;lt;code&amp;gt;php7&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt; must be previously installed from stable.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7-dba php7-sqlite3 php7-mysqli php7-mysqlnd php7-pgsql php7-pdo_dblib php7-pdo_odbc php7-pdo_pgsql php7-pdo_sqlite &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special case is &amp;lt;code&amp;gt;php7-odbc&amp;lt;/code&amp;gt;. Unless the others, that are able php to connect to only specific database, &#039;&#039;&#039;[[Production DataBases : unixodbc|unixodbc]]&#039;&#039;&#039; is a universal way to do so. The most important difference is, for example, the &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt; package has better functions to manage data via php.&lt;br /&gt;
&lt;br /&gt;
=== PHP Global Configuration ===&lt;br /&gt;
&lt;br /&gt;
# Use fix.pathinfo&lt;br /&gt;
# Set safe mode off&lt;br /&gt;
# Dont expose php code if something fails&lt;br /&gt;
# Set amount of memory limit for execution to 536Mb (most servers are minimum of 1 GB of RAM)&lt;br /&gt;
# Set upload size to 128Mb as maximun.&lt;br /&gt;
# Set POST max size to 256Mb based on the upload max size limit.&lt;br /&gt;
# Turn on the URL open method&lt;br /&gt;
# Set default charset to UTF-8 for increased compatibility&lt;br /&gt;
# Increase the execution time and the input time for.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i -r &#039;s|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*safe_mode =.*#safe_mode = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*expose_php =.*#expose_php = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#memory_limit =.*#memory_limit = 536M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#upload_max_filesize =.*#upload_max_filesize = 128M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#post_max_size =.*#post_max_size = 256M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^file_uploads =.*#file_uploads = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_file_uploads =.*#max_file_uploads = 12#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^allow_url_fopen = .*#allow_url_fopen = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.default_charset =.*#default_charset = &amp;quot;UTF-8&amp;quot;#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.max_execution_time =.*#max_execution_time = 150#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_input_time =.*#max_input_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PHP-FPM Configuration ===&lt;br /&gt;
&lt;br /&gt;
# Create directory for php socket and pid files, MUST BE EQUAL to openrc defined!&lt;br /&gt;
# Set into configuration file the socket path, MUST BE EQUAL to openrc defined!&lt;br /&gt;
# Set into configuration file the pid file path, MUST BE EQUAL to openrc defined!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/run/php-fpm7/&lt;br /&gt;
&lt;br /&gt;
chown lighttpd:root /var/run/php-fpm7&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^pid =.*|pid = /run/php-fpm7/php7-fpm.pid|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode =.*|listen.mode = 0640|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add php-fpm7 default&lt;br /&gt;
&lt;br /&gt;
service php-fpm7 restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PHP-FPM defines a master process with a process pool for each service request. By default, there&#039;s only one process pool, www.&lt;br /&gt;
&lt;br /&gt;
Default values are good for starting, but will need tuning later. The best is a static one, but testing is needed to get the right configuration.&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd + PHP-FPM ===&lt;br /&gt;
&lt;br /&gt;
The web server comes with a minimal config file, so we must handle all the required settings:&lt;br /&gt;
&lt;br /&gt;
# enable the mod_alias at the config file, a specific path is needed for cgi file security&lt;br /&gt;
# be sure and disable the fastcgi-php module by cgi only&lt;br /&gt;
# and then enable the fastcgi-php-fpm specific module then&lt;br /&gt;
# write a much much better approach of the php handler in the local server using the socket&lt;br /&gt;
# configure the php to use also the socket for direct connection locally&lt;br /&gt;
# restart the service to see changes at the browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -e &#039;/index-file.names/ s/^#*/#/&#039; -i /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = (&lt;br /&gt;
    &amp;quot;.php&amp;quot; =&amp;gt; (&lt;br /&gt;
      &amp;quot;localhost&amp;quot; =&amp;gt; (&lt;br /&gt;
        &amp;quot;socket&amp;quot;                =&amp;gt; &amp;quot;/var/run/php-fpm7/php7-fpm.sock&amp;quot;,&lt;br /&gt;
        &amp;quot;broken-scriptfilename&amp;quot; =&amp;gt; &amp;quot;enable&amp;quot;&lt;br /&gt;
      ))&lt;br /&gt;
)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /var/run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner = .*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group = .*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode = .*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For testing, open a browser and go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;webserveripaddres&amp;gt;/info.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You will see the info as used in production. &lt;br /&gt;
There&#039;s no sense givig too much information to crackers. The &amp;quot;webserveripaddres&amp;quot; is the ip address of your setup/server machine.&lt;br /&gt;
&lt;br /&gt;
After that, all the files with php will be procesed faster than used a host based. Under the &amp;lt;code&amp;gt;/var/www/localhost/cgi-bin&amp;lt;/code&amp;gt; directory will be shown as &amp;lt;nowiki&amp;gt;http://localhost/cgi-bin/&amp;lt;/nowiki&amp;gt; path.&lt;br /&gt;
&lt;br /&gt;
=== Multiple PHP-FPM cluster ===&lt;br /&gt;
&lt;br /&gt;
As we said, FPM is managed by process pools, but the connection can be over a network or over a direct n socket. The configuration for a typical server that can handle an average number requests is with socket and localhost. For high availability, a CAT6 wired network connection of 1000Mbps and php-fpm by network connection in roundrobin mode is needed.&lt;br /&gt;
&lt;br /&gt;
The PHP FPM pool will be on a specific machine and the web server(s) will simply connect to these machines with PHP to serve the PHP pages. The result is a cluster of lighttpd web servers against other PHP-FPM process clusters. The PHP code can be the same on all web servers and can connect to a single database.&lt;br /&gt;
&lt;br /&gt;
At the Linux console the changes are, for example, two machines 10.10.1.10 and 10.10.2.10 both have php and lighttpd, so each will set up the php of the other:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = ( &amp;quot;.php&amp;quot; =&amp;gt; &lt;br /&gt;
  (&lt;br /&gt;
    ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;10.10.1.10&amp;quot;,&lt;br /&gt;
      &amp;quot;port&amp;quot; =&amp;gt; 9000&lt;br /&gt;
    ),&lt;br /&gt;
    ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;10.10.2.10&amp;quot;,&lt;br /&gt;
      &amp;quot;port&amp;quot; =&amp;gt; 9000 )&lt;br /&gt;
    )&lt;br /&gt;
  )&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = 9000|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner = .*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group = .*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode = .*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 3. The DBMS part: mysql/mariadb ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has dummy counterpart packages for those not changed from &#039;&#039;mysql&#039;&#039; to &#039;&#039;mariadb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Take into consideration the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt; was created during package installation. 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 at that point only if they are in their respective system accounts, will they 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;
=== Initialization ===&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 you 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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Set up the root account by assigning a proper password. This is pure paranoia. the next step does just that!&lt;br /&gt;
# Set up and init the installation by running the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Set up permissions for managing other users and databases&lt;br /&gt;
# Run the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; script and answer the questions (see section below)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; must be provided because we set it previously. Correct response is &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; this must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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; Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise change it!&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond mus be  &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; For sure answer Y&#039;&#039;&#039; and proper respond mus be  &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; Should be removed, so answer Y&#039;&#039;&#039; and proper respond mus 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; Aanswer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
Newer Alpine system packages can set in independent files. In any case, those commands always work and where not applicable, they&#039;ll ignore the output. For more info about that, see the [[MariaDB#Configuration_files_and_customization|MariaDB Configuration files]] section of the MariaDB wiki page.&lt;br /&gt;
&lt;br /&gt;
* On older Alpine system you must set config files for MAX ALLOWED PACKETS to minimun proper amount:&lt;br /&gt;
* Only allow local connections in cases where there&#039;s only one server or no expected connections from others:&lt;br /&gt;
* Set default charset to UTF8MB4 (default from MariaDB 11.8 and MySQL 8)&lt;br /&gt;
* Add the start service process, but don&#039;t set it as a boot process because networking needs to already be running.&lt;br /&gt;
* Restart the service to apply changes.&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&lt;br /&gt;
rc-update add mariadb default&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Upgrading:&#039;&#039;&#039; If you are unable to run any mysql commands after an upgrade, it&#039;s because MySQL cannot start. Try to run MySQL in safe mode with the &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt; command, then run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script. For more information see the [[MariaDB#Updating_or_comming_from_upgrading|MariaDB upgrading section]] of the MariaDB wiki page.&lt;br /&gt;
&lt;br /&gt;
=== adminer: Web Frontend administration ===&lt;br /&gt;
&lt;br /&gt;
[https://www.adminer.org/ Adminer] is a simple standalone tool, tons of times faster than PhpMysqladmin that is great but has too many security issues and lots of complex settings. We need a single, simpler solution. One that&#039;s easy to manage and upgrade.&lt;br /&gt;
&lt;br /&gt;
Take into consideration this needs as a prerequisite, the previous sections of the web server, php scripting and mysql/mariadb engine configured and running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/webapps/adminer&lt;br /&gt;
&lt;br /&gt;
wget https://github.com/vrana/adminer/releases/download/v4.7.6/adminer-4.7.6.php -O /var/www/webapps/adminer/adminer-4.7.6.php&lt;br /&gt;
&lt;br /&gt;
ln -s adminer-4.7.6.php /var/www/webapps/adminer/index.php&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_adminer.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
# NOTE: this requires mod_alias&lt;br /&gt;
alias.url += (&lt;br /&gt;
     &amp;quot;/adminer/&amp;quot;	    =&amp;gt;	    &amp;quot;/var/www/webapps/adminer/&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/adminer/&amp;quot; {&lt;br /&gt;
    # disable directory listings&lt;br /&gt;
    dir-listing.activate = &amp;quot;disable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkssl=&amp;quot;&amp;quot;;checkssl=$(grep &#039;include &amp;quot;mod_adminer.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkssl&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#include &amp;quot;mod_cgi.conf&amp;quot;\ninclude &amp;quot;mod_adminer.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The administrator must use the exact URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;ipaddress&amp;gt;/adminer/index.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; There are two reasons: there&#039;s no directory listing and there&#039;s no direct PHP index reference on the web server, all because of paranoid settings.&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Web_Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL&amp;diff=29249</id>
		<title>Production LAMP system: Lighttpd + PHP + MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL&amp;diff=29249"/>
		<updated>2025-03-11T23:29:47Z</updated>

		<summary type="html">&lt;p&gt;Greenman: copyedits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In production web, &#039;&#039;&#039;LAMP&#039;&#039;&#039; means &#039;&#039;&#039;L&#039;&#039;&#039;inux + &#039;&#039;&#039;A&#039;&#039;&#039;pache + &#039;&#039;&#039;M&#039;&#039;&#039;ysql + &#039;&#039;&#039;P&#039;&#039;&#039;hp installed and integrated, but today, more and more, &#039;&#039;Apache&#039;&#039; is being replaced by &#039;&#039;Nginx&#039;&#039; or &#039;&#039;Lighttpd&#039;&#039; and &#039;&#039;[[MySQL]]&#039;&#039; by &#039;&#039;[[MariaDB]]&#039;&#039;. The &#039;&#039;LAMP&#039;&#039; documents are:&lt;br /&gt;
&lt;br /&gt;
== 1. The web server: Lighttpd ==&lt;br /&gt;
&lt;br /&gt;
[https://www.lighttpd.net/ lighttpd] is a simple, standards-compliant, secure, and flexible web server, Nginx is the most used due to beeing manageable by ISP panel&#039;s software, but &#039;&#039;&#039;lighttpd performs better. Nginx cannot process fast-cgi programs&#039;&#039;&#039;. For more lighttpd information, consult the [[Production Web server: Lighttpd]] wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd Installation ===&lt;br /&gt;
&lt;br /&gt;
Production environment will handle only needed packages. So no doc or managers allowed:&lt;br /&gt;
&lt;br /&gt;
# run apk for needed packages&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add lighttpd gamin&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd pre php configuration ===&lt;br /&gt;
&lt;br /&gt;
# make the htdos public web root directories &lt;br /&gt;
# change default port to production one, http is used with 80&lt;br /&gt;
# use FAM style (gamin) file alteration monitor, increases performance &#039;&#039;&#039;ONLY ON 3.4 to 3.8 releases!!!&#039;&#039;&#039;&lt;br /&gt;
# use linux event handler, increases performance due Alpine are linux only&lt;br /&gt;
# added the service to the default runlevel, not to boot, because networking needs to be active first&lt;br /&gt;
# started the web server service&lt;br /&gt;
# Enable the mod_status at the config files&lt;br /&gt;
# change path in the config file, we are using security by obfuscation&lt;br /&gt;
# restart the service to see changes at the browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs/stats /var/log/lighttpd /var/lib/lighttpd&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*server.port.*=.*#server.port          = 80#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*server.event-handler = &amp;quot;linux-sysepoll&amp;quot;.*#server.event-handler = &amp;quot;linux-sysepoll&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/www/localhost/&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/lib/lighttpd&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/log/lighttpd&lt;br /&gt;
&lt;br /&gt;
rc-update add lighttpd default&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;it works&amp;quot; &amp;gt; /var/www/localhost/htdocs/index.html&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_status.*,.*#    &amp;quot;mod_status&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*status.status-url.*=.*#status.status-url  = &amp;quot;/stats/server-status&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*status.config-url.*=.*#status.config-url  = &amp;quot;/stats/server-config&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For testing, open a browser and go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;webserveripaddres&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You will see &amp;quot;it works&amp;quot;&#039;&#039;&#039;. The &amp;quot;webserveripaddres&amp;quot; is the ip address of your setup/server machine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;There&#039;s a problem in Alpine linux, FAM (gamin) is activated as a lighttpd only service&#039;&#039;&#039;, that makes sense in docker, but on a server, it could be a problem if FAM (gamin) is also needed for other services at the same time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OPTIONAL:&#039;&#039;&#039; alpine packagers are a mess, removed FAM on recent, so older releases of alpine can use compiled FAM packages with &amp;lt;code&amp;gt;sed -i -r &#039;s#.*server.stat-cache-engine.*=.*# server.stat-cache-engine = &amp;quot;fam&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 2. php scripting: PHP fpm ==&lt;br /&gt;
&lt;br /&gt;
In Alpine there are two main languages for programming dynamic web pages: PHP and LUA. Alpine is minimalist so not all PHP packages are need in most cases.&lt;br /&gt;
Both repositories must be enabled (main and community). Here we explain the most common use in production.&lt;br /&gt;
&lt;br /&gt;
=== PHP Installation ===&lt;br /&gt;
&lt;br /&gt;
{{Obsolete|Update to a newer or generic php version}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7 php7-bcmath php7-bz2 php7-ctype php7-curl php7-dom php7-enchant php7-exif php7-fpm php7-gd php7-gettext php7-gmp php7-iconv php7-imap php7-intl php7-json php7-mbstring php7-opcache php7-openssl php7-phar php7-posix php7-pspell php7-recode php7-session php7-simplexml php7-sockets php7-sysvmsg php7-sysvsem php7-sysvshm php7-tidy php7-xml php7-xmlreader php7-xmlrpc php7-xmlwriter php7-xsl php7-zip php7-sqlite3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;The packages below are only for specific situations. Install them only when needed (especially php-pear)&#039;&#039;&#039;, for example, &amp;lt;code&amp;gt;cacti&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cacti-php7&amp;lt;/code&amp;gt; depend on &amp;lt;code&amp;gt;php7&amp;lt;/code&amp;gt;, but you must install &#039;&#039;&#039;only&#039;&#039;&#039; the cacti package, all the dependencies must be previously installed from stable.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7-pgsql php7-mysqli php7-mysqlnd php7-snmp php7-soap php7-ldap php7-pcntl php7-pear php7-shmop php7-wddx php7-cgi php7-pdo php7-snmp php7-tokenizer &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;The packages below are only for database access using php in specific ways. Install them only if you need them (specially php--pdo ones)&#039;&#039;&#039;. For example, &amp;lt;code&amp;gt;cacti&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cacti-php7&amp;lt;/code&amp;gt; depend on &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt;, but you must install only the cacti package, all the dependencies like &amp;lt;code&amp;gt;php7&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt; must be previously installed from stable.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7-dba php7-sqlite3 php7-mysqli php7-mysqlnd php7-pgsql php7-pdo_dblib php7-pdo_odbc php7-pdo_pgsql php7-pdo_sqlite &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special case is &amp;lt;code&amp;gt;php7-odbc&amp;lt;/code&amp;gt;. Unless the others, that are able php to connect to only specific database, &#039;&#039;&#039;[[Production DataBases : unixodbc|unixodbc]]&#039;&#039;&#039; is a universal way to do so. The most important difference is, for example, the &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt; package has better functions to manage data via php.&lt;br /&gt;
&lt;br /&gt;
=== PHP Global Configuration ===&lt;br /&gt;
&lt;br /&gt;
# Use fix.pathinfo&lt;br /&gt;
# Set safe mode off&lt;br /&gt;
# Dont expose php code if something fails&lt;br /&gt;
# Set amount of memory limit for execution to 536Mb (most servers are minimum of 1 GB of RAM)&lt;br /&gt;
# Set upload size to 128Mb as maximun.&lt;br /&gt;
# Set POST max size to 256Mb based on the upload max size limit.&lt;br /&gt;
# Turn on the URL open method&lt;br /&gt;
# Set default charset to UTF-8 for increased compatibility&lt;br /&gt;
# Increase the execution time and the input time for.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i -r &#039;s|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*safe_mode =.*#safe_mode = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*expose_php =.*#expose_php = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#memory_limit =.*#memory_limit = 536M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#upload_max_filesize =.*#upload_max_filesize = 128M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#post_max_size =.*#post_max_size = 256M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^file_uploads =.*#file_uploads = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_file_uploads =.*#max_file_uploads = 12#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^allow_url_fopen = .*#allow_url_fopen = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.default_charset =.*#default_charset = &amp;quot;UTF-8&amp;quot;#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.max_execution_time =.*#max_execution_time = 150#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_input_time =.*#max_input_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PHP-FPM Configuration ===&lt;br /&gt;
&lt;br /&gt;
# Create directory for php socket and pid files, MUST BE EQUAL to openrc defined!&lt;br /&gt;
# Set into configuration file the socket path, MUST BE EQUAL to openrc defined!&lt;br /&gt;
# Set into configuration file the pid file path, MUST BE EQUAL to openrc defined!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/run/php-fpm7/&lt;br /&gt;
&lt;br /&gt;
chown lighttpd:root /var/run/php-fpm7&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^pid =.*|pid = /run/php-fpm7/php7-fpm.pid|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode =.*|listen.mode = 0640|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add php-fpm7 default&lt;br /&gt;
&lt;br /&gt;
service php-fpm7 restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PHP-FPM defines a master process with a process pool for each service request. By default, there&#039;s only one process pool, www.&lt;br /&gt;
&lt;br /&gt;
Default values are good for starting, but will need tuning later. The best is a static one, but testing is needed to get the right configuration.&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd + PHP-FPM ===&lt;br /&gt;
&lt;br /&gt;
The web server comes with a minimal config file, so we must handle all the required settings:&lt;br /&gt;
&lt;br /&gt;
# enable the mod_alias at the config file, a specific path is needed for cgi file security&lt;br /&gt;
# be sure and disable the fastcgi-php module by cgi only&lt;br /&gt;
# and then enable the fastcgi-php-fpm specific module then&lt;br /&gt;
# write a much much better approach of the php handler in the local server using the socket&lt;br /&gt;
# configure the php to use also the socket for direct connection locally&lt;br /&gt;
# restart the service to see changes at the browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -e &#039;/index-file.names/ s/^#*/#/&#039; -i /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = (&lt;br /&gt;
    &amp;quot;.php&amp;quot; =&amp;gt; (&lt;br /&gt;
      &amp;quot;localhost&amp;quot; =&amp;gt; (&lt;br /&gt;
        &amp;quot;socket&amp;quot;                =&amp;gt; &amp;quot;/var/run/php-fpm7/php7-fpm.sock&amp;quot;,&lt;br /&gt;
        &amp;quot;broken-scriptfilename&amp;quot; =&amp;gt; &amp;quot;enable&amp;quot;&lt;br /&gt;
      ))&lt;br /&gt;
)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /var/run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner = .*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group = .*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode = .*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For testing, open a browser and go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;webserveripaddres&amp;gt;/info.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You will see the info as used in production. &lt;br /&gt;
There&#039;s no sense givig too much information to crackers. The &amp;quot;webserveripaddres&amp;quot; is the ip address of your setup/server machine.&lt;br /&gt;
&lt;br /&gt;
After that, all the files with php will be procesed faster than used a host based. Under the &amp;lt;code&amp;gt;/var/www/localhost/cgi-bin&amp;lt;/code&amp;gt; directory will be shown as &amp;lt;nowiki&amp;gt;http://localhost/cgi-bin/&amp;lt;/nowiki&amp;gt; path.&lt;br /&gt;
&lt;br /&gt;
=== Multiple PHP-FPM cluster ===&lt;br /&gt;
&lt;br /&gt;
As we said, FPM is managed by process pools, but the connection can be over a network or over a direct n socket. The configuration for a typical server that can handle an average number requests is with socket and localhost. For high availability, a CAT6 wired network connection of 1000Mbps and php-fpm by network connection in roundrobin mode is needed.&lt;br /&gt;
&lt;br /&gt;
The PHP FPM pool will be on a specific machine and the web server(s) will simply connect to these machines with PHP to serve the PHP pages. The result is a cluster of lighttpd web servers against other PHP-FPM process clusters. The PHP code can be the same on all web servers and can connect to a single database.&lt;br /&gt;
&lt;br /&gt;
At the Linux console the changes are, for example, two machines 10.10.1.10 and 10.10.2.10 both have php and lighttpd, so each will set up the php of the other:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = ( &amp;quot;.php&amp;quot; =&amp;gt; &lt;br /&gt;
  (&lt;br /&gt;
    ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;10.10.1.10&amp;quot;,&lt;br /&gt;
      &amp;quot;port&amp;quot; =&amp;gt; 9000&lt;br /&gt;
    ),&lt;br /&gt;
    ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;10.10.2.10&amp;quot;,&lt;br /&gt;
      &amp;quot;port&amp;quot; =&amp;gt; 9000 )&lt;br /&gt;
    )&lt;br /&gt;
  )&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = 9000|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner = .*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group = .*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode = .*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 3. The DBMS part: mysql/mariadb ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has dummy counterpart packages for those not changed from &#039;&#039;mysql&#039;&#039; to &#039;&#039;mariadb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Take into consideration the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt; was created during package installation. 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 at that point only if they are in their respective system accounts, will they 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;
=== Initialization ===&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 you 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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Set up the root account by assigning a proper password. This is pure paranoia. the next step does just that!&lt;br /&gt;
# Set up and init the installation by running the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Set up permissions for managing other users and databases&lt;br /&gt;
# Run the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; script and answer the questions (see section below)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; must be provided because we set it previously. Correct response is &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; this must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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; Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise change it!&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond mus be  &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; For sure answer Y&#039;&#039;&#039; and proper respond mus be  &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; Should be removed, so answer Y&#039;&#039;&#039; and proper respond mus 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; Aanswer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
Newer Alpine system packages can set in independent files. In any case, those commands always work and where not applicable, they&#039;ll ignore the output. For more info about that, see the [[MariaDB#Configuration_files_and_customization|MariaDB Configuration files]] section of the MariaDB wiki page.&lt;br /&gt;
&lt;br /&gt;
* On older Alpine system you must set config files for MAX ALLOWED PACKETS to minimun proper amount:&lt;br /&gt;
* Only allow local connections in cases where there&#039;s only one server or no expected connections from others:&lt;br /&gt;
* Set default charset to UTF8MB4&lt;br /&gt;
* Add the start service process, but don&#039;t set it as a boot process because networking needs to already be running.&lt;br /&gt;
* Restart the service to apply changes.&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&lt;br /&gt;
rc-update add mariadb default&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Upgrading:&#039;&#039;&#039; If you are unable to run any mysql commands after an upgrade, it&#039;s because MySQL cannot start. Try to run MySQL in safe mode with the &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt; command, then run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script. For more information see the [[MariaDB#Updating_or_comming_from_upgrading|MariaDB upgrading section]] of the MariaDB wiki page.&lt;br /&gt;
&lt;br /&gt;
=== adminer: Web Frontend administration ===&lt;br /&gt;
&lt;br /&gt;
[https://www.adminer.org/ Adminer] is a simple standalone tool, tons of times faster than PhpMysqladmin that is great but has too many security issues and lots of complex settings. We need a single, simpler solution. One that&#039;s easy to manage and upgrade.&lt;br /&gt;
&lt;br /&gt;
Take into consideration this needs as a prerequisite, the previous sections of the web server, php scripting and mysql/mariadb engine configured and running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/webapps/adminer&lt;br /&gt;
&lt;br /&gt;
wget https://github.com/vrana/adminer/releases/download/v4.7.6/adminer-4.7.6.php -O /var/www/webapps/adminer/adminer-4.7.6.php&lt;br /&gt;
&lt;br /&gt;
ln -s adminer-4.7.6.php /var/www/webapps/adminer/index.php&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_adminer.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
# NOTE: this requires mod_alias&lt;br /&gt;
alias.url += (&lt;br /&gt;
     &amp;quot;/adminer/&amp;quot;	    =&amp;gt;	    &amp;quot;/var/www/webapps/adminer/&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/adminer/&amp;quot; {&lt;br /&gt;
    # disable directory listings&lt;br /&gt;
    dir-listing.activate = &amp;quot;disable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkssl=&amp;quot;&amp;quot;;checkssl=$(grep &#039;include &amp;quot;mod_adminer.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkssl&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#include &amp;quot;mod_cgi.conf&amp;quot;\ninclude &amp;quot;mod_adminer.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The administrator must use the exact URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;ipaddress&amp;gt;/adminer/index.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; There are two reasons: there&#039;s no directory listing and there&#039;s no direct PHP index reference on the web server, all because of paranoid settings.&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Web_Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL&amp;diff=29248</id>
		<title>Production LAMP system: Lighttpd + PHP + MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Production_LAMP_system:_Lighttpd_%2B_PHP_%2B_MySQL&amp;diff=29248"/>
		<updated>2025-03-11T23:29:11Z</updated>

		<summary type="html">&lt;p&gt;Greenman: links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In production web, &#039;&#039;&#039;LAMP&#039;&#039;&#039; means &#039;&#039;&#039;L&#039;&#039;&#039;inux + &#039;&#039;&#039;A&#039;&#039;&#039;pache + &#039;&#039;&#039;M&#039;&#039;&#039;ysql + &#039;&#039;&#039;P&#039;&#039;&#039;hp installed and integrated, but today, more and more, &#039;&#039;Apache&#039;&#039; is being replaced by &#039;&#039;Nginx&#039;&#039; or &#039;&#039;Lighttpd&#039;&#039; and &#039;&#039;[[MySQL]]&#039;&#039; by &#039;&#039;[[MariaDB]]&#039;&#039;. The &#039;&#039;LAMP&#039;&#039; documents are:&lt;br /&gt;
&lt;br /&gt;
== 1. The web server: Lighttpd ==&lt;br /&gt;
&lt;br /&gt;
[https://www.lighttpd.net/ lighttpd] is a simple, standards-compliant, secure, and flexible web server, Nginx is the most used due to beeing manageable by ISP panel&#039;s software, but &#039;&#039;&#039;lighttpd performs better. Nginx cannot process fast-cgi programs&#039;&#039;&#039;. For more lighttpd information, consult the [[Production Web server: Lighttpd]] wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd Installation ===&lt;br /&gt;
&lt;br /&gt;
Production environment will handle only needed packages. So no doc or managers allowed:&lt;br /&gt;
&lt;br /&gt;
# run apk for needed packages&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add lighttpd gamin&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd pre php configuration ===&lt;br /&gt;
&lt;br /&gt;
# make the htdos public web root directories &lt;br /&gt;
# change default port to production one, http is used with 80&lt;br /&gt;
# use FAM style (gamin) file alteration monitor, increases performance &#039;&#039;&#039;ONLY ON 3.4 to 3.8 releases!!!&#039;&#039;&#039;&lt;br /&gt;
# use linux event handler, increases performance due Alpine are linux only&lt;br /&gt;
# added the service to the default runlevel, not to boot, because networking needs to be active first&lt;br /&gt;
# started the web server service&lt;br /&gt;
# Enable the mod_status at the config files&lt;br /&gt;
# change path in the config file, we are using security by obfuscation&lt;br /&gt;
# restart the service to see changes at the browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs/stats /var/log/lighttpd /var/lib/lighttpd&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*server.port.*=.*#server.port          = 80#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*server.event-handler = &amp;quot;linux-sysepoll&amp;quot;.*#server.event-handler = &amp;quot;linux-sysepoll&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/www/localhost/&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/lib/lighttpd&lt;br /&gt;
&lt;br /&gt;
chown -R lighttpd:lighttpd /var/log/lighttpd&lt;br /&gt;
&lt;br /&gt;
rc-update add lighttpd default&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;it works&amp;quot; &amp;gt; /var/www/localhost/htdocs/index.html&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_status.*,.*#    &amp;quot;mod_status&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*status.status-url.*=.*#status.status-url  = &amp;quot;/stats/server-status&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*status.config-url.*=.*#status.config-url  = &amp;quot;/stats/server-config&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For testing, open a browser and go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;webserveripaddres&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You will see &amp;quot;it works&amp;quot;&#039;&#039;&#039;. The &amp;quot;webserveripaddres&amp;quot; is the ip address of your setup/server machine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;There&#039;s a problem in Alpine linux, FAM (gamin) is activated as a lighttpd only service&#039;&#039;&#039;, that makes sense in docker, but on a server, it could be a problem if FAM (gamin) is also needed for other services at the same time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OPTIONAL:&#039;&#039;&#039; alpine packagers are a mess, removed FAM on recent, so older releases of alpine can use compiled FAM packages with &amp;lt;code&amp;gt;sed -i -r &#039;s#.*server.stat-cache-engine.*=.*# server.stat-cache-engine = &amp;quot;fam&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 2. php scripting: PHP fpm ==&lt;br /&gt;
&lt;br /&gt;
In Alpine there are two main languages for programming dynamic web pages: PHP and LUA. Alpine is minimalist so not all PHP packages are need in most cases.&lt;br /&gt;
Both repositories must be enabled (main and community). Here we explain the most common use in production.&lt;br /&gt;
&lt;br /&gt;
=== PHP Installation ===&lt;br /&gt;
&lt;br /&gt;
{{Obsolete|Update to a newer or generic php version}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7 php7-bcmath php7-bz2 php7-ctype php7-curl php7-dom php7-enchant php7-exif php7-fpm php7-gd php7-gettext php7-gmp php7-iconv php7-imap php7-intl php7-json php7-mbstring php7-opcache php7-openssl php7-phar php7-posix php7-pspell php7-recode php7-session php7-simplexml php7-sockets php7-sysvmsg php7-sysvsem php7-sysvshm php7-tidy php7-xml php7-xmlreader php7-xmlrpc php7-xmlwriter php7-xsl php7-zip php7-sqlite3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;The packages below are only for specific situations. Install them only when needed (especially php-pear)&#039;&#039;&#039;, for example, &amp;lt;code&amp;gt;cacti&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cacti-php7&amp;lt;/code&amp;gt; depend on &amp;lt;code&amp;gt;php7&amp;lt;/code&amp;gt;, but you must install &#039;&#039;&#039;only&#039;&#039;&#039; the cacti package, all the dependencies must be previously installed from stable.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7-pgsql php7-mysqli php7-mysqlnd php7-snmp php7-soap php7-ldap php7-pcntl php7-pear php7-shmop php7-wddx php7-cgi php7-pdo php7-snmp php7-tokenizer &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;The packages below are only for database access using php in specific ways. Install them only if you need them (specially php--pdo ones)&#039;&#039;&#039;. For example, &amp;lt;code&amp;gt;cacti&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cacti-php7&amp;lt;/code&amp;gt; depend on &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt;, but you must install only the cacti package, all the dependencies like &amp;lt;code&amp;gt;php7&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt; must be previously installed from stable.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add php7-dba php7-sqlite3 php7-mysqli php7-mysqlnd php7-pgsql php7-pdo_dblib php7-pdo_odbc php7-pdo_pgsql php7-pdo_sqlite &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special case is &amp;lt;code&amp;gt;php7-odbc&amp;lt;/code&amp;gt;. Unless the others, that are able php to connect to only specific database, &#039;&#039;&#039;[[Production DataBases : unixodbc|unixodbc]]&#039;&#039;&#039; is a universal way to do so. The most important difference is, for example, the &amp;lt;code&amp;gt;php7-mysqli&amp;lt;/code&amp;gt; package has better functions to manage data via php.&lt;br /&gt;
&lt;br /&gt;
=== PHP Global Configuration ===&lt;br /&gt;
&lt;br /&gt;
# Use fix.pathinfo&lt;br /&gt;
# Set safe mode off&lt;br /&gt;
# Dont expose php code if something fails&lt;br /&gt;
# Set amount of memory limit for execution to 536Mb (most servers are minimum of 1 GB of RAM)&lt;br /&gt;
# Set upload size to 128Mb as maximun.&lt;br /&gt;
# Set POST max size to 256Mb based on the upload max size limit.&lt;br /&gt;
# Turn on the URL open method&lt;br /&gt;
# Set default charset to UTF-8 for increased compatibility&lt;br /&gt;
# Increase the execution time and the input time for.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i -r &#039;s|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*safe_mode =.*#safe_mode = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*expose_php =.*#expose_php = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#memory_limit =.*#memory_limit = 536M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#upload_max_filesize =.*#upload_max_filesize = 128M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#post_max_size =.*#post_max_size = 256M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^file_uploads =.*#file_uploads = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_file_uploads =.*#max_file_uploads = 12#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^allow_url_fopen = .*#allow_url_fopen = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.default_charset =.*#default_charset = &amp;quot;UTF-8&amp;quot;#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.max_execution_time =.*#max_execution_time = 150#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_input_time =.*#max_input_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PHP-FPM Configuration ===&lt;br /&gt;
&lt;br /&gt;
# Create directory for php socket and pid files, MUST BE EQUAL to openrc defined!&lt;br /&gt;
# Set into configuration file the socket path, MUST BE EQUAL to openrc defined!&lt;br /&gt;
# Set into configuration file the pid file path, MUST BE EQUAL to openrc defined!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/run/php-fpm7/&lt;br /&gt;
&lt;br /&gt;
chown lighttpd:root /var/run/php-fpm7&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^pid =.*|pid = /run/php-fpm7/php7-fpm.pid|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode =.*|listen.mode = 0640|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add php-fpm7 default&lt;br /&gt;
&lt;br /&gt;
service php-fpm7 restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PHP-FPM defines a master process with a process pool for each service request. By default, there&#039;s only one process pool, www.&lt;br /&gt;
&lt;br /&gt;
Default values are good for starting, but will need tuning later. The best is a static one, but testing is needed to get the right configuration.&lt;br /&gt;
&lt;br /&gt;
=== Lighttpd + PHP-FPM ===&lt;br /&gt;
&lt;br /&gt;
The web server comes with a minimal config file, so we must handle all the required settings:&lt;br /&gt;
&lt;br /&gt;
# enable the mod_alias at the config file, a specific path is needed for cgi file security&lt;br /&gt;
# be sure and disable the fastcgi-php module by cgi only&lt;br /&gt;
# and then enable the fastcgi-php-fpm specific module then&lt;br /&gt;
# write a much much better approach of the php handler in the local server using the socket&lt;br /&gt;
# configure the php to use also the socket for direct connection locally&lt;br /&gt;
# restart the service to see changes at the browser&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -e &#039;/index-file.names/ s/^#*/#/&#039; -i /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = (&lt;br /&gt;
    &amp;quot;.php&amp;quot; =&amp;gt; (&lt;br /&gt;
      &amp;quot;localhost&amp;quot; =&amp;gt; (&lt;br /&gt;
        &amp;quot;socket&amp;quot;                =&amp;gt; &amp;quot;/var/run/php-fpm7/php7-fpm.sock&amp;quot;,&lt;br /&gt;
        &amp;quot;broken-scriptfilename&amp;quot; =&amp;gt; &amp;quot;enable&amp;quot;&lt;br /&gt;
      ))&lt;br /&gt;
)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /var/run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner = .*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group = .*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode = .*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For testing, open a browser and go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;webserveripaddres&amp;gt;/info.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. You will see the info as used in production. &lt;br /&gt;
There&#039;s no sense givig too much information to crackers. The &amp;quot;webserveripaddres&amp;quot; is the ip address of your setup/server machine.&lt;br /&gt;
&lt;br /&gt;
After that, all the files with php will be procesed faster than used a host based. Under the &amp;lt;code&amp;gt;/var/www/localhost/cgi-bin&amp;lt;/code&amp;gt; directory will be shown as &amp;lt;nowiki&amp;gt;http://localhost/cgi-bin/&amp;lt;/nowiki&amp;gt; path.&lt;br /&gt;
&lt;br /&gt;
=== Multiple PHP-FPM cluster ===&lt;br /&gt;
&lt;br /&gt;
As we said, FPM is managed by process pools, but the connection can be over a network or over a direct n socket. The configuration for a typical server that can handle an average number requests is with socket and localhost. For high availability, a CAT6 wired network connection of 1000Mbps and php-fpm by network connection in roundrobin mode is needed.&lt;br /&gt;
&lt;br /&gt;
The PHP FPM pool will be on a specific machine and the web server(s) will simply connect to these machines with PHP to serve the PHP pages. The result is a cluster of lighttpd web servers against other PHP-FPM process clusters. The PHP code can be the same on all web servers and can connect to a single database.&lt;br /&gt;
&lt;br /&gt;
At the Linux console the changes are, for example, two machines 10.10.1.10 and 10.10.2.10 both have php and lighttpd, so each will set up the php of the other:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = ( &amp;quot;.php&amp;quot; =&amp;gt; &lt;br /&gt;
  (&lt;br /&gt;
    ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;10.10.1.10&amp;quot;,&lt;br /&gt;
      &amp;quot;port&amp;quot; =&amp;gt; 9000&lt;br /&gt;
    ),&lt;br /&gt;
    ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;10.10.2.10&amp;quot;,&lt;br /&gt;
      &amp;quot;port&amp;quot; =&amp;gt; 9000 )&lt;br /&gt;
    )&lt;br /&gt;
  )&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = 9000|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner = .*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group = .*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode = .*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 3. The DBMS part: mysql/mariadb ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux has dummy counterpart packages for those not changed from &#039;&#039;mysql&#039;&#039; to &#039;&#039;mariadb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Take into consideration the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt; was created during package instalation. 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 at that point only if they are in their respective system accounts, will they 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;
=== Initialization ===&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 you 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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Set up the root account by asigning a proper password. This is pure paranoia. the next step does just that!&lt;br /&gt;
# Set up and init the installation by running the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Set up permissions for managing other users and databases&lt;br /&gt;
# Run the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; script and answer the questions (see section below)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; must be provided because we set it previously. Correct response is &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; this must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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; Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise change it!&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond mus be  &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; For sure answer Y&#039;&#039;&#039; and proper respond mus be  &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; Should be removed, so answer Y&#039;&#039;&#039; and proper respond mus 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; Aanswer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
Newer Alpine system packages can set in independent files. In any case, those commands always work and where not applicable, they&#039;ll ignore the output. For more info about that, see the [[MariaDB#Configuration_files_and_customization|MariaDB Configuration files]] section of the MariaDB wiki page.&lt;br /&gt;
&lt;br /&gt;
* On older Alpine system you must set config files for MAX ALLOWED PACKETS to minimun proper amount:&lt;br /&gt;
* Only allow local connections in cases where there&#039;s only one server or no expected connections from others:&lt;br /&gt;
* Set default charset to UTF8MB4&lt;br /&gt;
* Add the start service process, but don&#039;t set it as a boot process because networking needs to already be running.&lt;br /&gt;
* Restart the service to apply changes.&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&lt;br /&gt;
rc-update add mariadb default&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Upgrading:&#039;&#039;&#039; If you are unable to run any mysql commands after an upgrade, it&#039;s because MySQL cannot start. Try to run MySQL in safe mode with the &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt; command, then run the &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script. For more information see the [[MariaDB#Updating_or_comming_from_upgrading|MariaDB upgrading section]] of the MariaDB wiki page.&lt;br /&gt;
&lt;br /&gt;
=== adminer: Web Frontend administration ===&lt;br /&gt;
&lt;br /&gt;
[https://www.adminer.org/ Adminer] is a simple standalone tool, tons of times faster than PhpMysqladmin that is great but has too many security issues and lots of complex settings. We need a single, simpler solution. One that&#039;s easy to manage and upgrade.&lt;br /&gt;
&lt;br /&gt;
Take into consideration this needs as a prerequisite, the previous sections of the web server, php scripting and mysql/mariadb engine configured and running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/webapps/adminer&lt;br /&gt;
&lt;br /&gt;
wget https://github.com/vrana/adminer/releases/download/v4.7.6/adminer-4.7.6.php -O /var/www/webapps/adminer/adminer-4.7.6.php&lt;br /&gt;
&lt;br /&gt;
ln -s adminer-4.7.6.php /var/www/webapps/adminer/index.php&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_adminer.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
# NOTE: this requires mod_alias&lt;br /&gt;
alias.url += (&lt;br /&gt;
     &amp;quot;/adminer/&amp;quot;	    =&amp;gt;	    &amp;quot;/var/www/webapps/adminer/&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/adminer/&amp;quot; {&lt;br /&gt;
    # disable directory listings&lt;br /&gt;
    dir-listing.activate = &amp;quot;disable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkssl=&amp;quot;&amp;quot;;checkssl=$(grep &#039;include &amp;quot;mod_adminer.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkssl&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#include &amp;quot;mod_cgi.conf&amp;quot;\ninclude &amp;quot;mod_adminer.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The administrator must use the exact URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://&amp;lt;ipaddress&amp;gt;/adminer/index.php&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; There are two reasons: there&#039;s no directory listing and there&#039;s no direct PHP index reference on the web server, all because of paranoid settings.&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Web_Server]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29247</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29247"/>
		<updated>2025-03-11T23:25:03Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* MariaDB vs MySQL */ copyedit, remove dubious claims&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumes that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how it is packaged for Alpine Linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased. MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster. There is a third option, Percona Server, which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || ~10, but some in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Vectors || Yes, from MariaDB 11.7 || Enterprise-only &lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || Enterprise-only&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Temporal tables || yes || no&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || MySQL Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || no&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (GitHub)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29246</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29246"/>
		<updated>2025-03-11T23:21:25Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Comparison table */ temporal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumes that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how it is packaged for Alpine Linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || ~10, but some in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Vectors || Yes, from MariaDB 11.7 || Enterprise-only &lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || Enterprise-only&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Temporal tables || yes || no&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || MySQL Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || no&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (GitHub)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29245</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29245"/>
		<updated>2025-03-11T23:19:42Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Comparison table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumes that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how it is packaged for Alpine Linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || ~10, but some in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Vectors || Yes, from MariaDB 11.7 || Enterprise-only &lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || Enterprise-only&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || MySQL Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || not have&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (github)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29244</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29244"/>
		<updated>2025-03-11T23:18:14Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Comparison table */ around 10&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumes that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how it is packaged for Alpine Linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || ~10, but some in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || yes (Enterprise only)&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || MySQL Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || not have&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (github)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29243</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29243"/>
		<updated>2025-03-11T23:16:15Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* MariaDB vs MySQL */ clarify, copyedit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumes that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how it is packaged for Alpine Linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || up to 12 but many in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || yes (Enterprise only)&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || MySQL Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || not have&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (github)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29242</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29242"/>
		<updated>2025-03-11T23:13:31Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* MySQL (MariaDB) - Production usage */ copyedit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumes that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how it is packaged for Alpine Linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || up to 12 but many in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || yes&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || Mysql Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || not have&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (github)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29241</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29241"/>
		<updated>2025-03-11T23:11:17Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Configuration */ secure-installation&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;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
The Alpine Linux repositories no longer include the actual MySQL binaries, installing the &amp;lt;code&amp;gt;mysql-*&amp;lt;/code&amp;gt; packages will instead install MariaDB. &lt;br /&gt;
&lt;br /&gt;
Installing &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; will create the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. When the database is initialized, two users will be added to the database: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. By default these users will only be accessible if you are logged in as the corresponding system user.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add {{pkg|mariadb|arch=}} {{pkg|mariadb-client|arch=}}}}&lt;br /&gt;
&lt;br /&gt;
Installing the above packages will add the main components of MariaDB to the system: &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;. Other available packages are described in the table below, and are listed in order of relevance for a 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;
| {{Pkg|mysql}} || v2 || a transitional package that installs mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mysql-client}} || v2 || a transitional package that installs the mariadb client tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb}} || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-client}} || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-doc}} || v3.0 || manpages for mariadb || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-odbc}} || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-c}} || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-backup}} || v3.8 || tool for physical online backups, no longer widely used || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-server-utils}} || v3.8 || server commands not widely used, in past was inside MariaDB package || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-dev}} || v3.1 || development files for MariaDB || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-test}} || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-mytop}} || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-plugin-rocksdb}} || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-static}} || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-embedded}} || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|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;
| {{Pkg|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 version of MariaDB in the Alpine repositories behave like the MySQL tarball. No graphical tools are included.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at {{Path|/var/lib/mysql}} must be owned by the mysql user and group. The location of the &#039;&#039;datadir&#039;&#039; can be changed by editing the &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; service file in {{Path|/etc/init.d}}. The new location will also need to be set by adding &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; in the &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; section in a mariadb configuration file.&lt;br /&gt;
&lt;br /&gt;
Normal initialization of mariadb can be done as follows:&lt;br /&gt;
&lt;br /&gt;
# Start the main service. At this point there will be no root password set. &amp;lt;code&amp;gt;rc-service mariadb start&amp;lt;/code&amp;gt;&lt;br /&gt;
# Secure the database by running &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for managing others users and databases see: &#039;&#039;&#039;[[#Configuration|Configuration]]&#039;&#039;&#039;&lt;br /&gt;
# Add MariaDb to OpenRC. &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to help with the basic configuration of the database engine, MariaDB provides [https://mariadb.com/kb/en/mariadb-secure-installation/ mariadb-secure-installation]. &lt;br /&gt;
&lt;br /&gt;
Many of the reasons for running this script are no longer necessary, since MariaDB has defaulted to Unix socket authentication since MariaDB 10.4.&lt;br /&gt;
&lt;br /&gt;
This script walks you through the basics of securing the database. The options are explained below.&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. If not, just press enter.&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. For non-production servers just press &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; Here you can change the root password, or set one if needed. Press &amp;quot;Y&amp;quot; and enter the new password.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Unless you&#039;re sure you need this, answer &amp;quot;Y&amp;quot; to remove them.&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. Answer &amp;quot;Y&amp;quot;.&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, answer &amp;quot;Y&amp;quot;.&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 &amp;quot;Y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
After the script exits, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start the database daemon on every boot, run &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Rather than being stored in {{Path|my.cnf}}, configuration settings for MariaDB are now organized in separate files. The primary configuration is done by adding files to {{Path|/etc/my.cnf.d/}}. User-specific configuration files are stored in {{Path|~/.my.cnf}}. User-specific configuration files are loaded after the system-wide configuration. The locations of the various configuration files are listed below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/mysql/my.cnf}} || v2 to v3.8 || All the directives, global config file&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/my.cnf.d/mariadb-server.cnf}} || since 3.9 || First global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| {{path|$HOME/.my.cnf}} || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, this page describes basic usage of MariaDB. For professional usage, [[MySQL]] should also be referenced.&lt;br /&gt;
&lt;br /&gt;
* The following command will configure the server to accept all incoming connections. This should only be done for development, or if the database is not exposed to the Internet or a sensitive network.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
* For simple installations, disabling hostname search can improve performance, but is only useful for local servers.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
When upgrading between Alpine Linux releases, MariaDB may also have a major version change, and the databases should be upgraded to match. The recommended steps in this process are detailed below.&lt;br /&gt;
&lt;br /&gt;
# While it may no longer be strictly necessary, it&#039;s useful to backup your databases before upgrading the database version.&lt;br /&gt;
# Update Alpine Linux and the MariaDB/MySQL packages.&lt;br /&gt;
# Install mariadb-server-utils by running &amp;lt;code&amp;gt;apk add {{pkg|mariadb-server-utils|arch=}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, and provide the password for the root database user.&lt;br /&gt;
# Restart the service by running &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;mysql_upgrade&amp;lt;/code&amp;gt; fails because MySQL cannot start, try running MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt;, and then run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
= Create a user =&lt;br /&gt;
You should want to create a user with will access to a database remotly&lt;br /&gt;
&lt;br /&gt;
So open mariadb Client: &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add the user with associated host and password: &amp;lt;code&amp;gt; CREATE OR REPLACE USER admin@&#039;%&#039; IDENTIFIED BY &#039;ASecurePassword&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: @&#039;%&#039; allow connection from anny host&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MySQL]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29240</id>
		<title>MariaDB</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MariaDB&amp;diff=29240"/>
		<updated>2025-03-11T23:08:14Z</updated>

		<summary type="html">&lt;p&gt;Greenman: No basis for this claim&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;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
The Alpine Linux repositories no longer include the actual MySQL binaries, installing the &amp;lt;code&amp;gt;mysql-*&amp;lt;/code&amp;gt; packages will instead install MariaDB. &lt;br /&gt;
&lt;br /&gt;
Installing &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; will create the user &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. When the database is initialized, two users will be added to the database: &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;. By default these users will only be accessible if you are logged in as the corresponding system user.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add {{pkg|mariadb|arch=}} {{pkg|mariadb-client|arch=}}}}&lt;br /&gt;
&lt;br /&gt;
Installing the above packages will add the main components of MariaDB to the system: &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;. Other available packages are described in the table below, and are listed in order of relevance for a 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;
| {{Pkg|mysql}} || v2 || a transitional package that installs mariadb || mariadb&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mysql-client}} || v2 || a transitional package that installs the mariadb client tools || mariadb-client&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb}} || v2 || server equivalent to mysql-server || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-client}} || v2 || connection command line and tools || mariadb-common&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-doc}} || v3.0 || manpages for mariadb || man man-pages&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-odbc}} || edge || coding or making OS level connections, to any DB without libs install || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-connector-c}} || v3.8 || coding connection on C sources || mariadb-connector-c-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-backup}} || v3.8 || tool for physical online backups, no longer widely used || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-server-utils}} || v3.8 || server commands not widely used, in past was inside MariaDB package || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-dev}} || v3.1 || development files for MariaDB || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-test}} || v3.3 || testing suite from MariaDB tools || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-mytop}} || v3.9 || data performance monitoring || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-plugin-rocksdb}} || v3.9 || plain key-value event relational for data || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-static}} || v3.8 || static libs for static non depends linking in builds || .&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|mariadb-embedded}} || v3.9 || the libmysqld identical interface as the C client || mariadb-embedded-dev&lt;br /&gt;
|-&lt;br /&gt;
| {{Pkg|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;
| {{Pkg|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 version of MariaDB in the Alpine repositories behave like the MySQL tarball. No graphical tools are included.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; located at {{Path|/var/lib/mysql}} must be owned by the mysql user and group. The location of the &#039;&#039;datadir&#039;&#039; can be changed by editing the &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt; service file in {{Path|/etc/init.d}}. The new location will also need to be set by adding &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; in the &amp;lt;code&amp;gt;[mysqld]&amp;lt;/code&amp;gt; section in a mariadb configuration file.&lt;br /&gt;
&lt;br /&gt;
Normal initialization of mariadb can be done as follows:&lt;br /&gt;
&lt;br /&gt;
# Start the main service. At this point there will be no root password set. &amp;lt;code&amp;gt;rc-service mariadb start&amp;lt;/code&amp;gt;&lt;br /&gt;
# Secure the database by running &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;&lt;br /&gt;
# Setup permissions for managing others users and databases see: &#039;&#039;&#039;[[#Configuration|Configuration]]&#039;&#039;&#039;&lt;br /&gt;
# Add MariaDb to OpenRC. &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
In order to help with the basic configuration of the database engine, MariaDB provides &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt;.&lt;br /&gt;
This script walks you through the basics of securing the database. The options are explained below.&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. If not, just press enter.&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. For non-production servers just press &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; Here you can change the root password, or set one if needed. Press &amp;quot;Y&amp;quot; and enter the new password.&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; Remove anonymous users created to log in using socket authentication. Unless you&#039;re sure you need this, answer &amp;quot;Y&amp;quot; to remove them.&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. Answer &amp;quot;Y&amp;quot;.&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, answer &amp;quot;Y&amp;quot;.&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 &amp;quot;Y&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
After the script exits, restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start the database daemon on every boot, run &amp;lt;code&amp;gt;rc-update add mariadb default&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files and customization ===&lt;br /&gt;
&lt;br /&gt;
Rather than being stored in {{Path|my.cnf}}, configuration settings for MariaDB are now organized in separate files. The primary configuration is done by adding files to {{Path|/etc/my.cnf.d/}}. User-specific configuration files are stored in {{Path|~/.my.cnf}}. User-specific configuration files are loaded after the system-wide configuration. The locations of the various configuration files are listed below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config file !! Versions of Alpine !! Contents to configure&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/mysql/my.cnf}} || v2 to v3.8 || All the directives, global config file&lt;br /&gt;
|-&lt;br /&gt;
| {{Path|/etc/my.cnf.d/mariadb-server.cnf}} || since 3.9 || First global config file, main directives&lt;br /&gt;
|-&lt;br /&gt;
| {{path|$HOME/.my.cnf}} || all || user name only config directives&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, this page describes basic usage of MariaDB. For professional usage, [[MySQL]] should also be referenced.&lt;br /&gt;
&lt;br /&gt;
* The following command will configure the server to accept all incoming connections. This should only be done for development, or if the database is not exposed to the Internet or a sensitive network.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
* For simple installations, disabling hostname search can improve performance, but is only useful for local servers.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;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;
&lt;br /&gt;
== Updating or coming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
When upgrading between Alpine Linux releases, MariaDB may also have a major version change, and the databases should be upgraded to match. The recommended steps in this process are detailed below.&lt;br /&gt;
&lt;br /&gt;
# While it may no longer be strictly necessary, it&#039;s useful to backup your databases before upgrading the database version.&lt;br /&gt;
# Update Alpine Linux and the MariaDB/MySQL packages.&lt;br /&gt;
# Install mariadb-server-utils by running &amp;lt;code&amp;gt;apk add {{pkg|mariadb-server-utils|arch=}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; script, and provide the password for the root database user.&lt;br /&gt;
# Restart the service by running &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;mysql_upgrade&amp;lt;/code&amp;gt; fails because MySQL cannot start, try running MySQL in safemode with &amp;lt;code&amp;gt;mysqld_safe --datadir=/var/lib/mysql/&amp;lt;/code&amp;gt;, and then run &amp;lt;code&amp;gt;mysql_upgrade -u root -p&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
= Create a user =&lt;br /&gt;
You should want to create a user with will access to a database remotly&lt;br /&gt;
&lt;br /&gt;
So open mariadb Client: &amp;lt;code&amp;gt;mariadb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add the user with associated host and password: &amp;lt;code&amp;gt; CREATE OR REPLACE USER admin@&#039;%&#039; IDENTIFIED BY &#039;ASecurePassword&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;NB: @&#039;%&#039; allow connection from anny host&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MySQL]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29239</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29239"/>
		<updated>2025-03-11T23:04:41Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Comparison table */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumed that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how are packaged for alpine linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || up to 12 but many in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || yes&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || Mysql Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || not have&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (github)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info, see:&lt;br /&gt;
* https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility&lt;br /&gt;
* http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29238</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MySQL&amp;diff=29238"/>
		<updated>2025-03-11T23:02:42Z</updated>

		<summary type="html">&lt;p&gt;Greenman: /* Comparison table */ MariaDB has had since 5.3, in the previous decade :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;MySQL is the most popular relational database server in free software for two simple reasons (which are not the best technical reasons):&lt;br /&gt;
# It&#039;s simple and very easy to use&lt;br /&gt;
# It is very similar to SQLSERVER and is also used in other systems&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the world of Linux Alpine there is a software that provides it&#039;&#039;&#039;, it is [[MariaDB]], here we have a brief of info about compatibility and differences, but in short there&#039;s no great differences, if you have doubts check [[MySQL#MariaDB vs MySQL|MariaDB vs MySQL section here]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In the wiki there are two approaches for its use&#039;&#039;&#039;, the professional one (for servers and deploys) and the [[MariaDB|fast and simple]] usage (for developers and/or enthusiasts):&lt;br /&gt;
&lt;br /&gt;
= MariaDB - fast and simple use =&lt;br /&gt;
&lt;br /&gt;
{{:MariaDB}}&lt;br /&gt;
&lt;br /&gt;
= MySQL (MariaDB) - Production usage =&lt;br /&gt;
&lt;br /&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;
This page assumed that you have a general knowledge about MariaDB, so if you are new to MySQL first take a look at the [[MariaDB|MariaDB wiki page]] for information about how are packaged for alpine linux.&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, please check the [[MariaDB|MariaDB wiki page]] for more information.&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 be know what they want.. there&#039;s no automatic window-like here.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;datadir&#039;&#039; are located to &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&lt;br /&gt;
# Then initialize the service, root account and socket connection are enabled without password at this point&lt;br /&gt;
# Setup the root account by asignes a proper password, this are purely paranoid. due next step already do that!&lt;br /&gt;
# Setup and init the installation by running the &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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysqladmin -u root password toor&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, all are initializated to proceed with configuration, now can be done using the &amp;lt;code&amp;gt;&lt;br /&gt;
mysql_secure_installation&amp;lt;/code&amp;gt; script at the next section:&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_instalation&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; this are if you previously setup as we done in previous section a root password, just provide it and press enter, &#039;&#039;&#039;must be provided due we already set previously&#039;&#039;&#039; and from now, this sript will access to the engine and alter many setting on the database. Correct respond are &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. Since mysql 5.6 and mariadb 10.2 a new auth mechanish are set, by socket authentiaction, when system user are same as mysql/mariadb user, in this case, no password are need. In production servers this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &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 answer are here only if the first one are just enter, or if can provide a better passowrd if no unix socket are set. Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just &lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; this permits remove the anonymous user created to log using socket authentication, only working on unix-like system. In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond must be  &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;. This ensures that someone cannot guess at the root password from the network. For sure answer Y&#039;&#039;&#039; and proper respond must be  &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. This is also intended only for testing, and should be removed, so answer Y&#039;&#039;&#039; and proper respond must 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, so answer Y&#039;&#039;&#039; and proper respond must be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuration files ===&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;
&lt;br /&gt;
=== Production settings ===&lt;br /&gt;
&lt;br /&gt;
These setting are only recommended for some server settings, there are the recommendation for high production settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Config setting !! Default !! Recommended !! Explanation&lt;br /&gt;
|-&lt;br /&gt;
| main ram || 2G || 8G - 16G || MariaDB/MySQL can run with 512M or 1G of ram, high production must use minimun of 4G or more.&lt;br /&gt;
|-&lt;br /&gt;
| data dir disk type || any || SSD || MariaDB/MySQL must run with faster SSD if high request will be produced.&lt;br /&gt;
|-&lt;br /&gt;
| collation_server || utf8_unicode_ci || utf8mb4_unicode_ci || With 8mb4 some characters are able to use more than a single byte.&lt;br /&gt;
|-&lt;br /&gt;
| character_set_client || iso8859-1 || utf8 or utf8mb4 || Important due are standard, for left to right use 8mb4 flavor&lt;br /&gt;
|-&lt;br /&gt;
| max_connections || 151 || 100 || total_connections = total_processes * (total_threads + script_servers + 1)&lt;br /&gt;
|-&lt;br /&gt;
| max_heap_table_size || 16M || 32M || allocate more memory to memory tables, for memory storage engines&lt;br /&gt;
|-&lt;br /&gt;
| tmp_table_size || 16M || 32M || It allows the sub queries to remain more in memory, making them faster&lt;br /&gt;
|-&lt;br /&gt;
| join_buffer_size || 32M || 64M || It allows the join queries to remain more in memory rather in temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_file_format || unset || Barracuda || will allow longer indexes for important most used tables&lt;br /&gt;
|-&lt;br /&gt;
| innodb_large_prefix || unset || 1 || Must set if Barracuda file format are choosen&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_size || 128M || 456M || hold as much tables and indexes in system memory as is possible&lt;br /&gt;
|-&lt;br /&gt;
| innodb_read_io_threads || 16 || 32 || On high I/O systems, a value greater than 1 may allow the disk I/O to be more sequential&lt;br /&gt;
|-&lt;br /&gt;
| innodb_write_io_threads || 16 || 32 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_buffer_pool_instances || 1 || 2 or 4 || Only for older MySQL/MariaDB engines,&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity || 200 || 1200 - 2600 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|-&lt;br /&gt;
| innodb_io_capacity_max || 200 || 2400 - 5200 || Only if you have SSD storage for the data MySQL/MariaDB database and temp files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you have SSD disks, use the recommended suggestion, otherwise, use minimum suggested. If you have physical hard drives, use 2000 * the number of active drives in the array. If using NVMe or PCIe Flash, much larger numbers as high as 200000 can be used, but those lasted storage devices will be a short life of course.&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;
* On older Alpine system must set config files for MAX ALLOWED PACKETS to minimun proper amount:&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|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|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;
* Only allow local connections on cases where there&#039;s only one server or no expected to connect from others:&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=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|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;
* If are not 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;
* Set default charset to UTF8MB4, in newer versions (since Alpine v3.9), just added a new file to added thus customization, but older versions (below Alpine v3.8)of the package does not have a charset section, so you must added manually to the main configuration in each respective section:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Updating or comming from upgrading ==&lt;br /&gt;
&lt;br /&gt;
Mayor Upgrades beetween 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 sheme) 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 sheme). 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;
= Relevant important notes =&lt;br /&gt;
&lt;br /&gt;
== File system notes about the databases managed ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Btrfs Notes&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
If the database (in &amp;lt;code&amp;gt;/var/lib/mysql&amp;lt;/code&amp;gt;) resides on a [[Btrfs|btrfs]] file system, you should consider disabling &#039;&#039;&#039;Copy-on-Write&#039;&#039;&#039; for the directory before creating any database (schemes), after initialization you can enabled again. But .. on every database creation (scheme creation), you must disabled again, to avoid corrupted data.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ZFS Bock sizes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ZFS, unlike most other file systems, has a variable record size, or what is commonly referred to as a block size. By default, the recordsize on ZFS is 128KiB, which means it will dynamically allocate blocks of any size from 512B to 128KiB depending on the size of file being written. Most RDBMSes work in 8KiB-sized blocks by default. Although the block size is tunable for MySQL/MariaDB use an 8KiB block size by default.&lt;br /&gt;
&lt;br /&gt;
It is usually desirable to tune ZFS instead to accommodate the databases, using a command such as &amp;lt;code&amp;gt;zfs set recordsize=8K /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides) and in the interest of saving memory, it is best to simply disable ZFS&#039;s caching of the database&#039;s file data and let the database do its own job  with &amp;lt;code&amp;gt;zfs set primarycache=metadata /var/lib/mysql&amp;lt;/code&amp;gt; (or change /var/lib/mysql to the mount point where /var/lib/mysql resides).&lt;br /&gt;
&lt;br /&gt;
But beware, these kinds of tuning parameters are only if RDBMSes are setup in dedicated partitions, if your root and of course database are all in one partition, dont do that. Separate ones.&lt;br /&gt;
&lt;br /&gt;
== Restore root password ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
rc-service mysql stop&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
/usr/bin/mysqld --datadir=/var/lib/mysql --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking &amp;amp;&lt;br /&gt;
&lt;br /&gt;
mysql -e &amp;quot;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;MyNewPass&#039;;FLUSH PRIVILEGES;set password = password(&#039;MyNewPass&#039;);&amp;quot;&lt;br /&gt;
&lt;br /&gt;
kill  `cat /run/mysqld/mysqld.pid`&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB|MariaDB wiki page]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&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;br /&gt;
&lt;br /&gt;
= MariaDB vs MySQL =&lt;br /&gt;
&lt;br /&gt;
It is more a matter of compatibility than of performance and characteristics (with the arrival of MySQL v8) .. and it depends on whether there is a purely business and support approach &amp;quot;zero concern&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
MySQL, being from Oracle, establishes limits if a license is not purchased, MariaDB has a large connection pool, more than 200,000 connections, while MySQL has a smaller connection pool if it is not licensed.&lt;br /&gt;
&lt;br /&gt;
However, MariaDB does not support data masking and dynamic column while MySQL supports it, also MariaDB although it has 12 new storage engines while MySQL has less these are very new and MySQL&#039;s are widely known and tested.&lt;br /&gt;
&lt;br /&gt;
In terms of performance, MariaDB is only a little faster than MySQL, this is because MySQL implements more business features, but this is only noticeable using these many features.&lt;br /&gt;
&lt;br /&gt;
Which is more optimal this is not clear .. in general MySQL should be less, and MariaDB faster, there is a third option which is Percona which is the same MySQL service but with special aggressive optimization patches for servers. Percona mysql code must be compiled in Alpine linux.&lt;br /&gt;
&lt;br /&gt;
== Comparison table ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Characteristic !! MariaDB !! MySQL&lt;br /&gt;
|-&lt;br /&gt;
| Storage Engines || up to 12 but many in development stage || less but well tested&lt;br /&gt;
|-&lt;br /&gt;
| Performance || just a little faster || less, there is almost no difference&lt;br /&gt;
|-&lt;br /&gt;
| Initial version  || 2009 (5.3) || 1995 (3.0)&lt;br /&gt;
|-&lt;br /&gt;
| Data masking || no || yes&lt;br /&gt;
|-&lt;br /&gt;
| Dynamic columns || [https://mariadb.com/kb/en/dynamic-columns/ yes] || yes&lt;br /&gt;
|-&lt;br /&gt;
| Monitoring || SQLyog || MySQLworkbench&lt;br /&gt;
|-&lt;br /&gt;
| Routing || MariaDB MaxScale || Mysql Router&lt;br /&gt;
|-&lt;br /&gt;
| Analytics || MariaDB ColumnStore || not have&lt;br /&gt;
|-&lt;br /&gt;
| Git starred times (github)|| [https://github.com/MariaDB/server around 5.9k] || [https://github.com/mysql/mysql-server around 11.2k]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For more info check a review here: http://qgqlochekone.blogspot.com/2020/04/mariadb-mysql-and-mysqlworkbench.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Greenman</name></author>
	</entry>
</feed>