homehowtokbslinksaboutcontactprojectsmusic

Index > Knowledge Base > MySQL Cheatsheet
cat << eot >> ~/.my.cnf
[mysqldump]
user=mysqluser
password=secret
eot
Make sure to update your credentials
nano ~/.my.cnf
repair table marked as crashed from MySQL console #145 - Table './DB_NAME/tbl' is marked as crashed
repair table tbl;

Queries

math in update queries
UPDATE table SET filed = (filed + ((filed * 100) / 5) WHERE some_condition;
update data length, change table name, column and lenght
UPDATE table SET col = LEFT(col, 4)
update and alter
UPDATE table SET col = LEFT(col, 4); ALTER TABLE table MODIFY col varchar(4)