Skip to content

Instantly share code, notes, and snippets.

@lucascaton
Forked from duderamos/mysql-commands.md
Created May 11, 2017 04:33
Show Gist options
  • Save lucascaton/cb4269029d75b21bd018617a2d65a683 to your computer and use it in GitHub Desktop.
Save lucascaton/cb4269029d75b21bd018617a2d65a683 to your computer and use it in GitHub Desktop.

MySQL commands

  • Show table collation from a database:
show table status from <database>;
  • Show collation from an entire database;
select default_character_set_name from information_schema.schemata s where schema_name = '<database>';
  • Show column collcation:
show full columns from <table>;
  • Alter charset and collation of a database:
alter database <database> character set utf8 collate utf8_unicode_ci;
  • Alter charset and collation of a table:
alter table <table> convert to character set utf8 collate utf8_unicode_ci;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment