The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Package:MariaDB"
Threesixes (talk | contribs) m |
m (add link to binary logs docs) |
||
(One intermediate revision by the same user not shown) | |||
Line 23: | Line 23: | ||
{{console|body=###i## rc-service mysql restart | {{console|body=###i## rc-service mysql restart | ||
###i## mysql_secure_installation}} | ###i## mysql_secure_installation}} | ||
=== Binary logs === | |||
The binary logs are used for database replication and they are enabled by default in {{f|/etc/mysql/mariadb.d/50-distro-server.cnf|}}: | |||
{{file|name=50-distro-server.cnf|body= | |||
[mysqld] | |||
log-bin | |||
}} | |||
One can disable binary logs by creating custom configuration file under {{f|/etc/mysql/mariadb.d/|}} and name it e.g. {{f|75-local.cnf}} with content: | |||
{{file|name=75-local.cnf|body= | |||
[mysqld] | |||
skip-log-bin | |||
}} | |||
The status of the binary logs can be inspected by the {{Package|dev-db/phpmyadmin}} or by the SQL command: | |||
{{file|lang=sql|desc=Show binary logs|body= | |||
SHOW BINARY LOGS; | |||
}} | |||
Binary log can be all removed: | |||
{{file|lang=sql|desc=Reset binary logs|body= | |||
RESET MASTER; | |||
}} | |||
{{warning|Use {{c|RESET MASTER}} only if you don't use replication at all or if the server is configured as master first time!}} | |||
Unmaintained binary log files will grow in count and size and they can consume considerable disk space (in my case it was more than 2 GB). Then | |||
one can purge old files by the {{c|PURGE BINARY LOGS}} SQL command. It can be used in two manners: | |||
{{file|lang=sql|desc=Remove logs older than given file|body=PURGE BINARY LOGS TO 'mariadb-bin.000036';}} | |||
{{file|lang=sql|desc=Remove logs older than given date|body=PURGE BINARY LOGS BEFORE '2017-08-24 11:13';}} | |||
{{tip|Purging old logs can be automated by the {{c|expire-logs-days}} configuration option, with number of days to keep logs.}} | |||
Log's file name can be configured by the {{c|log-basename}} or {{c|log-bin}} options. If not configured, the default {{f|mariadb-bin}} with | |||
numbered extension will be used. | |||
{{note|The default (unconfigured) log's file name was changed in time. The older MariaDB versions was using {{f|mysql-bin}} and even older setups was | |||
using hostname in name. It is safe to remove the old files, because they are not used by server more.}} | |||
=== External Resources === | === External Resources === | ||
*http://www.slideshare.net/bytebot/mariadb-10-the-complete-tutorial | * http://www.slideshare.net/bytebot/mariadb-10-the-complete-tutorial | ||
* [https://mariadb.com/kb/en/the-mariadb-library/binary-log/ MariaDB – Binary Log] | |||
see: | see: | ||
{{package|dev-db/mysql}} | {{package|dev-db/mysql}} | ||
{{EbuildFooter}} | {{EbuildFooter}} |
Latest revision as of 11:07, August 24, 2017
MariaDB
We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.
MariaDB is a drop in replacement for MySQL.
Mariadb's executable is /usr/bin/mysql
Mariadb's init script is /etc/init.d/mysql
Installation
root # emerge dev-db/mariadb
First Run & Lock Down
Mariadb requires configuration upon instillation.
To deploy Mariadb:
root # emerge --config dev-db/mariadb
root # rc-service mysql restart root # mysql_secure_installation
Binary logs
The binary logs are used for database replication and they are enabled by default in /etc/mysql/mariadb.d/50-distro-server.cnf
:
50-distro-server.cnf
[mysqld]
log-bin
One can disable binary logs by creating custom configuration file under /etc/mysql/mariadb.d/
and name it e.g. 75-local.cnf
with content:
75-local.cnf
[mysqld]
skip-log-bin
The status of the binary logs can be inspected by the No results or by the SQL command:
SHOW BINARY LOGS;
Binary log can be all removed:
RESET MASTER;
Use RESET MASTER
only if you don't use replication at all or if the server is configured as master first time!
Unmaintained binary log files will grow in count and size and they can consume considerable disk space (in my case it was more than 2 GB). Then
one can purge old files by the PURGE BINARY LOGS
SQL command. It can be used in two manners:
PURGE BINARY LOGS TO 'mariadb-bin.000036';
PURGE BINARY LOGS BEFORE '2017-08-24 11:13';
Purging old logs can be automated by the expire-logs-days
configuration option, with number of days to keep logs.
Log's file name can be configured by the log-basename
or log-bin
options. If not configured, the default mariadb-bin
with
numbered extension will be used.
The default (unconfigured) log's file name was changed in time. The older MariaDB versions was using mysql-bin
and even older setups was
using hostname in name. It is safe to remove the old files, because they are not used by server more.
External Resources
see: dev-db/mysql