MySQL: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 5: | Zeile 5: | ||
white-space: -o-pre-wrap; | white-space: -o-pre-wrap; | ||
word-wrap: break-word;"> | word-wrap: break-word;"> | ||
mysqlshow -u | mysqlshow -u <user name> -p[<password>] | ||
</pre> | </pre> | ||
Zeile 14: | Zeile 14: | ||
white-space: -o-pre-wrap; | white-space: -o-pre-wrap; | ||
word-wrap: break-word;"> | word-wrap: break-word;"> | ||
mysql -u | mysql -u <user name> -p | ||
mysql> use <database>; | mysql> use <database>; | ||
mysql> show tables from <database>; | mysql> show tables from <database>; | ||
Zeile 27: | Zeile 27: | ||
white-space: -o-pre-wrap; | white-space: -o-pre-wrap; | ||
word-wrap: break-word;"> | word-wrap: break-word;"> | ||
mysqldump -u | mysqldump -u <user name> -p[<password>] <database name> > <dump file name>.sql | ||
</pre> | </pre> | ||
== Backup einer Datenbank importieren: == | == Backup einer Datenbank importieren: == | ||
<pre> | <pre> | ||
mysql -u | mysql -u <user name> -p[<password>] <database name> < <dump file name>.sql | ||
</pre> | </pre> | ||
Zeile 41: | Zeile 41: | ||
white-space: -o-pre-wrap; | white-space: -o-pre-wrap; | ||
word-wrap: break-word;"> | word-wrap: break-word;"> | ||
mysql -u | mysql -u <user name> -p[<password>] | ||
</pre> | </pre> | ||
Version vom 4. April 2016, 20:00 Uhr
Datenbanken eines MySQL-Servers auflisten:
mysqlshow -u <user name> -p[<password>]
Tabellen und Felder auflisten
mysql -u <user name> -p mysql> use <database>; mysql> show tables from <database>; mysql> show fields from <table_name>; mysql> quit;
Backup einer Datenbank anlegen:
mysqldump -u <user name> -p[<password>] <database name> > <dump file name>.sql
Backup einer Datenbank importieren:
mysql -u <user name> -p[<password>] <database name> < <dump file name>.sql
Anmelden am MySQL-Server:
mysql -u <user name> -p[<password>]
Abmelden vom MySQL-Server:
quit;
Neuen Benutzer anlegen:
mysql> create user '<username>'@'%' identified by '<password>'; mysql> grant usage on *.* to '<username>'@'%' identified by '<password>';
Soll der Zugriff auf localhost beschränkt sein, dann überall localhost anstelle von % verwenden:
mysql> create user '<username>'@'localhost' identified by '<password>'; mysql> grant usage on *.* to '<username>'@'localhost' identified by '<password>';
Rechte für Datenbank zuweisen
grant all privileges on <database>.* to '<username>'@'localhost';
Zurück zu Allgemein