Installing and Configuring MySQL
This article is more of a cheat-sheet for myself, and less of a public facing post, but hopefully it can help someone else out.
Install and Start MySQL
Install MySQL using Homebrew: brew install mysql
If MySQL has not been added to the system path, run the following: export PATH=$PATH:/usr/local/mysql/bin
Create a User, Privileges and Password
Login to mysql as root: mysql -u root
Create user: mysql> CREATE USER 'username'@'localhost';
Grant all privileges: mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';
Run the following:
mysql> USE mysql; mysql> UPDATE user SET authentication_string='password' WHERE User='username'; mysql> FLUSH PRIVILEGES; mysql> quit;
Alternatively (as of version 8.0.15), the password can be updated:
mysql> USE mysql; mysql> ALTER USER 'username'@'localhost' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES; mysql> quit;
You now should be good to create a local database connection for the newly created username.
Create Database
mysql> CREATE DATABASE databasename;
Delete Database
mysql> DROP DATABASE databasename;