MySQL/CheatSheet

Connect/Disconnect
mysql -h -u -p mysql -h -u -p Enter password: ******** mysql -u user -p mysql mysql -h -u -p

Forgot root password?
$ /etc/init.d/mysql stop $ mysqld_safe --skip-grant-tables & $ mysql # on another terminal mysql> UPDATE mysql.user SET password=PASSWORD('nouveau') WHERE user='root'; $ /etc/init.d/mysql start
 * 1) Kill mysqld_safe from the terminal, using Control + \

Repair tables after unclean shutdown
mysqlcheck --all-databases mysqlcheck --all-databases --fast

Loading data
mysql> SOURCE input_file $ mysql database < filename-20120201.sql $ cat filename-20120201.sql | mysql database

MySQL/Syntaxe