|
MySQL crib
Often, when you develop a website, you notice how the developers come up against the same rake when designing a database.
Today I decided to publish my cribs, on the most common errors when working with MySQL.
Working with BackupsMaking Backupmysqldump -u USER -pPASSWORD DATABASE >/path/to/file/dump.sql
Create a database structure without datamysqldump --no-data - u USER -pPASSWORD DATABASE >/path/to/file/schema.sql
If you want to dump only one or more tablesmysqldump -u USER -pPASSWORD DATABASE TABLE1 TABLE2 TABLE3 >/path/to/file/dump_table.sql
Create a backup and immediately archive itmysqldump -u USER -pPASSWORD DATABASE | gzip >/path/to/outputfile.sql.gz
Creation of a backup with the indication of its datemysqldump -uUSER -pPASSWORD DATABASE | gzip > `date +/path/to/outputfile.sql.%Y%m%d.%H%M%S.gz`
Fill backup in the databasemysql -u USER -pPASSWORD DATABASE </path/to/dump.sql
Fill archive backup in the databasegunzip </path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE or like this zcat/path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE
Create a new databasemysqladmin -u USER -pPASSWORD create NEWDATABASE
It is convenient to use backup with additional options -Q -c -e ,mysqldump -Q -c -e -u USER -pPASSWORD DATABASE >/path/to/file/dump.sql , where:
mysqlshow -u USER -pPASSWORD
And you can also see the list of database tables:mysqlshow -u USER -pPASSWORD DATABASE
For InnoDB tables, you need to add --single-transaction, this ensures the integrity of the backup data.For MyISAN tables, this is not relevant, because they do not support transactionality. Details General facts
Working with dataNumbers
Rows
DatesDo not forget,
Enumerations
Debugging
|
For a web master
Textbooks, reference books
.htaccess
CHMOD
ERROR - table return codes
404
META tags
CSS
robots.txt
Protection from auto-fill forms
Redirect
Validity
Soft
Web soft
Best web-based utility
Online WYSIWYG
WAP software
Favicon
Favicon
Editors icons
Icon Generator online
Generator icons for online smartphone
RSS
RSS
Examples of RSS
Example Atom-document
|