Mysql/mariadb
Multi-Instanz MariaDB initialisieren
/usr/share/mariadb/scripts/mysql_install_db --user=mysql --datadir=/mnt/storage/mariadb/nexus-master --basedir=/usr
MariaDB-Instanz starten:
systemctl start mariadb@<Instanz>
root-Benutzer anlegen und Passwort festlegen:
/usr/bin/mysqladmin -u root password new-password
Neue Datenbank erstellen:
mysql -u root -p CREATE DATABASE <database>; CREATE USER 'name'@'localhost' IDENTIFIED BY 'password'; GRANT ALL ON <database>.* TO 'name'@'localhost'; FLUSH PRIVILEGES;
Benutzer hinzufügen und / oder Rechte setzen:
- Bei <hostname> kann auch ein '%' stehen, das steht dann für "alle", oder bei IP-Adressen: 192.168.1.%
GRANT ALL PRIVILEGES ON *.* TO '<username>'@'<hostname>' IDENTIFIED BY '<password>' WITH GRANT OPTION; FLUSH PRIVILEGES;
Zabbix Datenbank erstellen
shell> mysql -uroot -p<password> mysql> create database zabbix character set utf8 collate utf8_bin; mysql> create user 'zabbix'@'localhost' identified by '<password>'; mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost'; mysql> quit;
shell> cd database/mysql shell> mysql -uzabbix -p<password> zabbix < schema.sql # stop here if you are creating database for Zabbix proxy shell> mysql -uzabbix -p<password> zabbix < images.sql shell> mysql -uzabbix -p<password> zabbix < data.sql