MySQL Notes

ADD FOREIGN KEY
ALTER TABLE table1 ADD FOREIGN KEY (column_in_table1) REFERENCES table2(column_in_table2) ON DELETE CASCADE ON UPDATE CASCADE;
CHANGE COLUMN TYPE
ALTER TABLE table MODIFY column new_type;
CHANGE VALUES
UPDATE table SET column1 = value1 WHERE column1 = value2;
DELETE ALL ROWS
DELETE FROM table;
DUMP
From the shell, mysqldump -u root -p password database > database.sql
RENAME TABLE
ALTER TABLE table1 RENAME TO table2;
REPLACE FROM FILE TO TABLE
LOAD DATA INFILE file REPLACE INTO TABLE table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';
RESTORING DATABASE
mysql -u root -p password database < database.sql;
WARNINGS
SHOW WARNINGS;