MariaDB (Linux): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 69: | Zeile 69: | ||
<pre> | <pre> | ||
sudo vi /etc/logrotate.d/mysql-server | sudo vi /etc/logrotate.d/mysql-server | ||
</pre> | |||
<pre> | |||
# - I put everything in one block and added sharedscripts, so that mysql gets | |||
# flush-logs'd only once. | |||
# Else the binary logs would automatically increase by n times every day. | |||
# - The error log is obsolete, messages go to syslog now. | |||
/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log { | |||
daily | |||
rotate 7 | |||
missingok | |||
create 640 mysql adm | |||
compress | |||
sharedscripts | |||
postrotate | |||
test -x /usr/bin/mysqladmin || exit 0 | |||
if [ -f `my_print_defaults --mysqld | grep -m 1 -oP "pid-file=\K.+$"` ]; then | |||
# If this fails, check debian.conf! | |||
mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \ | |||
flush-engine-log flush-general-log flush-slow-log | |||
fi | |||
endscript | |||
} | |||
</pre> | </pre> | ||
Version vom 2. April 2020, 06:23 Uhr
Installation
sudo apt-get -y install mariadb-server mariadb-client
Als PHP-Connector kann der von MySQL genutzt werden:
sudo apt-get -y install php-mysql
Passwort
Passwort setzen
Raspbian
Unter Raspbian wird bei der Installation nicht nach einem root-Passwort gefragt.
Um es zu setzen, als root einloggen
sudo mysql -u root -p
und, falls in /etc/mysql/mariadb.conf.d/50-server.cnf als Adresse 127.0.0.1 eingetragen ist, folgende Befehle ausführen
grant all on *.* to 'root'@'localhost' identified by '<password>' with grant option; flush privileges; quit;
ansonsten:
grant all on *.* to 'root'@'%' identified by '<password>' with grant option; flush privileges; quit;
Passwort ändern
mysqladmin -p --user=root password "newpassword"
Links
http://www.fun-genius.com/dashboard/docs/reset-mysql-password.html
Replikation
Siehe dazu MariaDB Replikation
Query Log
https://mariadb.com/kb/en/general-query-log/
Probleme
logrotate[658]: error: 'Access denied for user 'root'@'localhost' (using password: NO)'
debian-start[7452]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Ursache
sudo vi /etc/logrotate.d/mysql-server
# - I put everything in one block and added sharedscripts, so that mysql gets # flush-logs'd only once. # Else the binary logs would automatically increase by n times every day. # - The error log is obsolete, messages go to syslog now. /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log { daily rotate 7 missingok create 640 mysql adm compress sharedscripts postrotate test -x /usr/bin/mysqladmin || exit 0 if [ -f `my_print_defaults --mysqld | grep -m 1 -oP "pid-file=\K.+$"` ]; then # If this fails, check debian.conf! mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \ flush-engine-log flush-general-log flush-slow-log fi endscript }
Abhilfe
sudo vi /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH! [client] host = localhost user = root password = "<password>" socket = /var/run/mysqld/mysqld.sock [mysql_upgrade] host = localhost user = root password = "<password>" socket = /var/run/mysqld/mysqld.sock basedir = /usr
Link
https://askubuntu.com/questions/876552/mysql-logrotate-error
Links
https://wiki.ubuntuusers.de/MariaDB/
Zurück zu Ubuntu