Skip to content

Instantly share code, notes, and snippets.

@mariotpc
Last active February 8, 2021 20:57
Show Gist options
  • Select an option

  • Save mariotpc/21ee33450e871b3b4c15ca36c24dedc7 to your computer and use it in GitHub Desktop.

Select an option

Save mariotpc/21ee33450e871b3b4c15ca36c24dedc7 to your computer and use it in GitHub Desktop.
Install mySQL-mariaDB on Alpine
Alpine Linux has dummy counterparts packages for those that are not close to that change from mysql to mariadb naming packages.
First One:
###########################
install the software:
alpine:/home/mariotpc# apk add mysql mysql-client
Second One
##############################
Execute the setup, using systemV script
alpine:/home/mariotpc# /etc/init.d/mariadb setup
* Creating a new MySQL database ...
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo
See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/var/lib/mysql'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl
##########################################
## IMPORTANT - TO RUN TESTs INSTALL ##
## mariadb-test Package ##
##########################################
alpine:/usr# apk add mariadb-test
(1/1) Installing mariadb-test (10.5.8-r0)
Executing busybox-1.32.1-r0.trigger
OK: 1340 MiB in 332 packages
Add Perl ( this is not optional )
##########################################
alpine:/usr/mysql-test# apk add perl
(1/1) Installing perl (5.32.0-r0)
Executing busybox-1.32.1-r0.trigger
OK: 1377 MiB in 333 packages
Add server-utils ( also not negotiated - You must install it !!! :)
##########################################
alpine:/usr/mysql-test# apk add mariadb-server-utils
(1/1) Installing mariadb-server-utils (10.5.8-r0)
Executing busybox-1.32.1-r0.trigger
OK: 1387 MiB in 334 packages
###############################################
Wojojojoj Many of tests "Requires debug build"
###############################################
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
[ ok ]
alpine:/home/mariotpc#
third one
##########################
Start your new Database
alpine:/home/mariotpc# /etc/init.d/mariadb start
* Caching service dependencies ... [ ok ]
* Starting mariadb ...
210208 13:16:33 mysqld_safe Logging to syslog.
210208 13:16:33 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql
fourth one
#####################################
Secure the installation by runningmysql_secure_installation
Follow all steps, and restart the service daemon
alpine:/home/mariotpc# rc-service mariadb restart
* Stopping mariadb ... [ ok ]
* Starting mariadb ...
210208 13:20:38 mysqld_safe Logging to syslog.
210208 13:20:38 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql
Add it to start by default
alpine:/home/mariotpc# rc-update add mariadb default
* service mariadb added to runlevel default
Fifth One
############################
Test it
alpine:/home/mariotpc# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.8-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.002 sec)
Taken from:
https://wiki.alpinelinux.org/wiki/MariaDB#Installation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment