Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:mysql_commands

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
becki:linux:mysql_commands [2015-10-23 11:38]
becki [Working with Data]
becki:linux:mysql_commands [2017-10-04 12:37] (aktuell)
becki
Zeile 65: Zeile 65:
  
 ===== MySql Commands == ===== MySql Commands ==
 +
 +<note important>​In order to get UTF-8 content, you must log in and mysqldump ​ with ''​----default-character-set=latin1''​. FIXME Dont know why!!</​note>​
 ==== Misc == ==== Misc ==
  
Zeile 97: Zeile 99:
 /* Alternative to create a user: */ /* Alternative to create a user: */
 CREATE USER myUser@localhost IDENTIFIED BY '​myPassword';​ CREATE USER myUser@localhost IDENTIFIED BY '​myPassword';​
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, LOCK ON myDb.* TO myUser@localhost;​+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, LOCK TABLES ​ON myDb.* TO myUser@localhost;​
  
 /* Delete the database with all tables. */ /* Delete the database with all tables. */
 DROP DATABASE myDb; DROP DATABASE myDb;
 </​code>​ </​code>​
 +
 +FIXME [[http://​dev.mysql.com/​doc/​refman/​5.7/​en/​grant.html|Manual]] says: Use of GRANT to create accounts ... is deprecated as of MySQL 5.7.6. Instead, perform these tasks using CREATE USER or ALTER USER.
  
 ==== Managing Tables == ==== Managing Tables ==
Zeile 151: Zeile 155:
 mysqldump [--opt] --all_databases > file mysqldump [--opt] --all_databases > file
 </​code>​ </​code>​
 +
 +To avoid root user and passwords in mysqldump, add a special user vor backups in mysql:
 +
 +<code sql>
 +  GRANT SELECT, LOCK TABLES ON *.* TO backupuser@localhost IDENTIFIED BY '​your_pass';​
 +</​code>​
 +
 +Create a file ''​.my.cnf''​ in the Linux home dir of the user:
 +  [client]
 +  password=your_pass
  
 FIXME Is this warning still relevant: FIXME Is this warning still relevant:
Zeile 159: Zeile 173:
   * Remove all appearences of ''​collate latin1_german2_ci''​   * Remove all appearences of ''​collate latin1_german2_ci''​
   * ''​mysqldump''​ inserts funny comments which seem to mess with the character set when imported. => Remove all comments in ''​backup-file.sql''​   * ''​mysqldump''​ inserts funny comments which seem to mess with the character set when imported. => Remove all comments in ''​backup-file.sql''​
-</​note>​ 
  
 +</​note>​
  
 ===== Old, German & unsorted == ===== Old, German & unsorted ==
becki/linux/mysql_commands.1445600332.txt.gz · Zuletzt geändert: 2015-10-23 11:38 von becki

Impressum - Datenschutzerklärung