====== MariaDB 10.3 ======
===== Installation from Debian 10 repositories =====
# apt update
# apt install mariadb-server
# mysql_secure_installation
Enter a root password.
* [[https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-debian-9|How To Install MariaDB on Debian 9]]
* [[https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-debian-11|How To Install MariaDB on Debian 11]]
* [[https://www.tecmint.com/transfer-mysql-databases-from-old-to-new-server/|How to Transfer All MySQL Databases From Old to New Server]]
===== phpMyAdmin =====
* [[deb11:phpmyadmin|phpMyAdmin]]
# apt update
# apt install phpmyadmin php-mbstring php-gettext
# phpenmod mbstring
# systemctl restart apache2
Select Yes when asked whether to use dbconfig-common to set up the database.
* [[https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-debian-9|How To Install and Secure phpMyAdmin on Debian 9]]
===== Adjusting User Authentication and Privileges =====
# mariadb -u root -p
MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
MariaDB [(none)]> exit
===== Securing Your phpMyAdmin Instance =====
Edit /etc/apache2/conf-available/phpmyadmin.conf:
Alias /phpmyadmin /usr/share/phpmyadmin
Options FollowSymLinks
DirectoryIndex index.php
# Allow user to access without password
Include conf-available/user-access.conf
AddType application/x-httpd-php .php
SetHandler application/x-httpd-php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/
conf-available/user-access.conf contains:
# Allow user to access without password
Require ip www.xx.yyy.zzz
===== Settings =====
* Modify the following in /etc/mysql/mariadb.conf.d/50-server.conf# * Query Cache Configuration
query_cache_limit = 64M
query_cache_size = 256M
# * InnoDB
innodb_buffer_pool_size = 1024M
# * Aria
aria_pagecache_buffer_size = 256M
* On my Debian 9 server with MariaDB 10.1 I had occasional db crashes with *** buffer overflow detected ***, so I added a CRON job to restart MariaDB once a week.
===== Trouble shooting =====
* [[https://downloads.mariadb.org/mariadb/repositories/#distro=Debian&distro_release=buster--buster&mirror=jaleco&version=10.4|Install MariaDB 10.4 on Debian 10]]
* [[https://computingforgeeks.com/how-to-install-mariadb-on-debian/|How To Install MariaDB 10.4 on Debian 10]]
* [[https://dba.stackexchange.com/questions/5666/possible-to-make-mysql-use-more-than-one-core|Possible to make MySQL use more than one core?]]
* [[https://dzone.com/articles/how-to-optimize-mysql-queries-for-speed-and-perfor|How to Optimize MySQL Queries for Speed and Performance]]
* [[http://www.fromdual.com/innodb-variables-and-status-explained#:~:text=InnoDB%20Buffer%20Pool,bytes%20with%20the%20innodb_buffer_pool_size%20variable.|InnoDB variables and status explained]]