This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create dump. | |
$ mysqldump -uroot -proot schema_name > file.sql | |
Restore dump. | |
$ mysql -uroot -proot schema_name < file.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
databaseChangeLog = { | |
changeSet(author: "adriano (generated)", id: "1473359854018-3") { | |
sql(""" | |
INSERT INTO bla (field) values (1); | |
""") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create dump. | |
$ mysqldump -uroot -proot schema_name table_name -w "date between '2013-01-01 00:00:00' and now()" | \ | |
gzip > schema_name_table_name.sql.gz | |
Restore dump. | |
$ gunzip schema_name_table_name.sql.gz | mysql -uroot -proot schema_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Required install PV (Pipe Viewer) | |
Create dump.*/ | |
$ mysqldump --single-transaction --skip-add-locks --skip-comments -uroot -proot schema | pv | gzip -c > file.sql.gz | |
/*Restore dump.*/ | |
$ pv file.sql.gz | gunzip | mysql -uroot -proot schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONCAT(table_schema, '.', table_name), | |
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, | |
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, | |
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, | |
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, | |
ROUND(index_length / data_length, 2) idxfrac | |
FROM information_schema.TABLES | |
ORDER BY data_length + index_length DESC | |
LIMIT 20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In BootStrap.conf | |
// TimeZone.availableIDs -> ['Etc/GMT+12', 'Etc/GMT+11', 'Pacific/Midway', 'Pacific/Niue'..... | |
TimeZone.setDefault(TimeZone.getTimeZone("America/Sao_Paulo")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/etc/mysql/my.cnf | |
default-storage-engine=innodb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE SCHEMA `name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE information_schema; | |
SELECT * FROM KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = 'table_name' AND REFERENCED_COLUMN_NAME = 'table_column' and TABLE_SCHEMA = 'schema_name'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create dump. | |
$ mysqldump -uroot -proot --no-data schema_name > file.sql | |
Restore dump. | |
$ mysql -uroot -proot schema_name < file.sql |
NewerOlder