Skip to content

Instantly share code, notes, and snippets.

@evgenii-malov
Last active August 28, 2016 10:42
Show Gist options
  • Save evgenii-malov/72775a52daa7d23df5d4191a47eeda71 to your computer and use it in GitHub Desktop.
Save evgenii-malov/72775a52daa7d23df5d4191a47eeda71 to your computer and use it in GitHub Desktop.

sudo mysqld_safe --user=mysql --skip-grant-tables #mysql without auth

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;

show processlist;

show create table <name>;

лучший способ удалить таблицу

MySQL has a convenient way to create empty tables like existing tables, and an atomic table rename command. Together, this is a fast way to clear out data:

CREATE TABLE new_foo LIKE foo;

RENAME TABLE foo TO old_foo, new_foo TO foo;

DROP TABLE old_foo;

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment