Categories
Uncategorized

MySQL for Developers Notes

From PlanetScale’s MySQL for Developers.

Strings

Charset defines what characters can go into a column.

SELECT * FROM information_schema.CHARACTER_SETS ORDER BY CHARACTER_SET_NAME;

A collation determines which characters are equal or greater in values in terms of sorting. e.g. is a == A or not? If not which is greater.

  • ai = accent insensitive
  • ci = case insensitive
Categories
Workflow

Broken MySQL after Homebrew installing Qcachegrind

MySQL died after rebooting after installing Qcachegrind.

I think the problem was brew update doing a ‘prune’ which removed /usr/local/etc/my.cnf.d

I recreated it manually and was able to start MySQL

cd /usr/local/bin
sudo mysql.server start
Categories
Servers

MySQL Create User and Grant Privileges

GRANT ALL PRIVILEGES ON mydatabase.* TO 'my_new_user'@'localhost' IDENTIFIED BY 'a great password';

Creates user and gives them privileges at once. Probably follow up with FLUSH PRIVILEGES