====== Login ======
$ mysql -u root -p
====== List Users ======
mysql> SELECT User FROM mysql.user;
====== Databases ======
===== List Databases =====
mysql> show databases;
===== Change/Select Database =====
mysql> use ;
====== Tables ======
===== List Tables =====
mysql> show tables;
===== List Table Columns =====
mysql> SHOW COLUMNS FROM ;
====== VARCHAR ======
The max length of varchar in MySQL is 64KB
VARCHAR(65535)
Lower with a multi-byte character set
VARCHAR(21844) CHARACTER SET utf8
====== Execute SQL File ======
mysql> source '///.sql';
====== Indexes ======
===== Add Index =====
mysql> ALTER TABLE ADD INDEX ();
===== Show Indexes =====
mysql> show index from ;
===== Drop Index =====
mysql> alter table drop index ;
====== Insert ======
===== Insert or Update =====
mysql> INSERT INTO (field1, field2, field3) VALUES ('value1', 'value2','value3') ON DUPLICATE KEY UPDATE field1='value1', field2='value2', field3='value3';