mysql snippets

rename table FooBar to foobar:

ALTER TABLE FooBar RENAME AS foobar;

rename column bar to foo:

ALTER TABLE foobar CHANGE bar foo VARCHAR(255) NOT NULL;

modify column definition:

ALTER TABLE foobar MODIFY foo BIGINT NOT NULL;

add new column baz after foo :

ALTER TABLE foobar ADD baz VARCHAR(60) AFTER foo;

optimize table:

OPTIMIZE TABLE foobar;

show tables description, columns etc:

DESCRIBE TABLE foobar;

show all available mysql users:

SELECT * FROM mysql.user;

delete mysql user:

DROP USER username@host;