Hibernate HQL to SQL Translation

For debugging purposes using hibernate it’s often usefull to have the generated SQL query to an appropriate HQL query.
But setting the hibernate configuration hibernate.show_sql to true leads to logging any query made within an application (which can be a lot in some applications). With the following class the hibernate API is used to generate the correct SQL query from a given HQL query and can be used anywhere to log the generated query.
“Hibernate HQL to SQL Translation” Weiter lesen

mysqldump backup with import & export

Kurz notiert:
Create a mysql-dump which can be easily imported again:

mysqldump -f --add-drop-table --user=MYSQL_USERNAME 
  --password=MYSQL_PASSWORD DATABASE-NAME >DATABASE-DUMP.sql 

Additional gzip-compression:

mysqldump -f --add-drop-table --user=MYSQL_USERNAME 
  --password=MYSQL_PASSWORD DATABASE-NAME | gzip --best > DATABASE-DUMP.sql.gz 

Load a dump back into a database:

mysql -u MYSQL_USERNAME --password=MYSQL_PASSWORD 
  -D DATABASE_NAME < DATABASE-DUMP.sql