MySQL installieren (Linux)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Installation

sudo apt-get -y install mysql-server

Ubuntu-Server 16.04

sudo apt-get -y install php-mysql 

Ubuntu-Server 14.04

sudo apt-get -y install php5-mysql

Netzwerkzugriff

Um auch von einem anderem Rechner auf die Datenbank zugreifen zu können, muss noch die IP-Adresse der Netzwerkschnittstelle eingestellt werden.

Dazu in der Konfigurationsdatei folgende Zeile anpassen:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = <static IP address>

Um alle Netzwerke zuzulassen, die Adresse 0.0.0.0 verwenden:

bind-address            = 0.0.0.0

Ubuntu-Server 16.04

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf 

Ubuntu-Server 14.04

sudo vi /etc/mysql/my.cnf

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 folgende Befehle ausführen:

grant all on *.* to root@localhost identified by '<password>' with grant option;
flush privileges;
quit;

Ubuntu 18.04

Mit sudo -i als root anmelden, danach in MySQL mittels

mysql -u root

anmelden und folgenden Kommandos ausführen:

ALTER USER 'root'@'localhost'
IDENTIFIED WITH mysql_native_password BY 'NeuesPasswort';
FLUSH privileges;
QUIT; 

Passwort zurücksetzen

https://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html

Werkzeuge

phpMyAdmin

Replikation

Siehe auch MySQL Cluster

Links

https://www.thomas-krenn.com/de/wiki/MySQL_Replikation

Probleme

mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode: Table 'performance_schema.session_variables' doesn't exist (1146)

mysql -u root -p
mysql> set @@global.show_compatibility_56=ON;

Links

https://bugs.mysql.com/bug.php?id=78159


Zurück zu Ubuntu