📜 ⬆️ ⬇️

MySQL cheat sheets

Often, when you develop a site, you notice how developers are attacking the same rake when designing a database.

Today I decided to publish my cheat sheets to the most common errors when working with MySQL.


Work with backups




mysqldump -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql


mysqldump --no-data - u USER -pPASSWORD DATABASE > /path/to/file/schema.sql


mysqldump -u USER -pPASSWORD DATABASE TABLE1 TABLE2 TABLE3 > /path/to/file/dump_table.sql


mysqldump -u USER -pPASSWORD DATABASE | gzip > /path/to/outputfile.sql.gz


mysqldump -u USER -pPASSWORD DATABASE | gzip > `date +/path/to/outputfile.sql.%Y%m%d.%H%M%S.gz`


mysql -u USER -pPASSWORD DATABASE < /path/to/dump.sql


gunzip < /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE

zcat /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE


mysqladmin -u USER -pPASSWORD create NEWDATABASE

-Q -c -e, ..
mysqldump -Q -c -e -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql, :


:
mysqlshow -u USER -pPASSWORD

:
mysqlshow -u USER -pPASSWORD DATABASE

InnoDB --single-transaction, .
MyISAN , .















,





dev.mysql.com/doc/refman/4.1/en/storage-requirements.html
help.scibit.com/mascon/masconMySQL_Field_Types.html





, , .

')

Source: https://habr.com/ru/post/105954/


All Articles