MYSQL Kommandos

Do., 31/05/2012 - 10:29
Body

Datenbank

https://linuxize.com/post/how-to-manage-mysql-databases-and-users-from-the-command-line/

Datenbank anzeigen angelgen, suer addden, permssions

 

 

 

 

http://linux.die.net/man/1/mysqldump http://www.linux-fuer-blinde.de/84-0-datenbank--und-benutzerverwaltung.html http://www.pantz.org/software/mysql/mysqlcommands.html | LISTE AN COMMANDS

CONSOLE

Login

mysql -u BENUTZERNAME -p DATENBANKNAME

Tabelle erzeugen create database postfix;

add user create user 'marco'@'localhost' identified by 'geheim';

rechte gewähren grant all on nameOfyourDb.* to 'marco'@'localhost';

alle datenbanken zeigen show databases;

Datenbank wählen use dbname;

Backup all databases

mysqldump --all-databases -p > file.dump

mysqldump --all-databases --user=root --password=mypassword > file.dump

Example back up a db mysqldump testdbcase_oc2 -p > tc4.sql

Backup einspielen

mysql -u BENUTZERNAME -p DATENBANKNAME < PFAD_ZUR_DATEI

Restore all databases

 mysql --user=root --password=mypassword < file.dump

Checkn & Repair

http://www.softwareprojects.com/resources/programming/t-how-to-fix-mysql-database-myisam-innodb-1634.html http://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html check

mysqlcheck --user=root --password=mypass texturesite_public 

 

 

Sample (userpoints)

free_reset.sql

UPDATE userpoints, users_roles SET userpoints.points = 15000 WHERE userpoints.uid = users_roles.uid AND users_roles.rid = 4

 

crontable 

# m h dom mon dow command

50 20 * * * /usr/bin/wget http://192.168.1.238/WORKSPACE_DRUPAL/artwaves_drupal_texturesite/cron.php

*/2 * * * * mysql --user=USERNAME --password=PASSWORT -D databasename < /home/www-data/free_reset.sql

 

Webdevelopment
Add new comment
The content of this field is kept private and will not be shown publicly.

Plain text

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.