MySQL – Kurzanleitung

Veröffentlichung 6. Juli 2018 @ 18:44
Letzte Änderung 6. Juli 2018 @ 18:44

Voraussetzungen

Netzwerk

  • MySQL-Benutzer root
  • Port 3306

Software

  • MySQL 5.7.22 #mysql –version
  • Ubuntu Server 16.04.04 LTS #lsb_release -a

Ordner und Dateien

  • Konfiguration /etc/mysql, /etc/mysql/mysql.conf.d, /root/.my.cnf
  • Log /var/log/mysql/error.log
  • systemd /lib/systemd/system/mysql.service

MySQL installieren

apt install mysql-server
  Neues Passwort für den MySQL root-Benutzer: ***

Installation absichern

mysql_secure_installation
  Would you like to setup VALIDATE PASSWORD plugin? <Enter> #No
  Change the password for root? <Enter> #No
  Remove anonymous users? y
  Disallow root login remotely? y
  Remove test database and access to it? y
  Reload privilege tables now? y

[Optional] SQL-Modus anpassen

...
[mysqld]
...
sql-mode="TRADITIONAL"

[Optional] Maximale Anzahl der gleichzeitigen Verbindungen zu MySQL erhöhen

...
[mysqld]
...
#max_connections = 100
max_connections = 256
...

MySQL-Konfgurationsdatei für root-Cron-Jobs und Skripte ohne Passwortabfrage anlegen

[client]
user=root
password=***
chmod 0600 /root/.my.cnf

MySQL neustarten und Status abfragen

systemctl restart mysql
systemctl status mysql.service

Logdatei überprüfen und Warnungen beseitigen

...
xxx [Warning] Changed limits: max_open_files: 1024 (requested 5000)
xxx [Warning] Changed limits: table_open_cache: 497 (requested 2000)
xxx [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
...
xxx [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
...
...
open_files_limit=1024
table_open_cache=497
explicit_defaults_for_timestamp=1
skip_ssl #SSL bei rein lokaler Nutzung nicht erforderlich
systemctl restart mysql

Quellen

https://dev.mysql.com/doc/refman/5.7/en/encrypted-connection-options.html
https://dev.mysql.com/doc/refman/5.7/en/option-files.html
https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html
https://www.mysql.com/

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert