MySQL

James Sessford • March 8, 2020

ubuntu reminders

I always forget how to do some MySQL operations, especially the more modern ways to add users. I'm listing them here in hopes of either cementing the information because I've written it down or finding my own blog post when I have to search again :)

Depening on what environment you're working in, you could be accessing MySQL in a multitude of different ways. I'm currently using DBeaver & MyCLI on my Ubuntu laptop & HeidiSQL at work.

Databases

CREATE DATABASE mydatabase;

Users

CREATE USER 'mydatabaseuser'@'%' IDENTIFIED WITH mysql_native_password BY 'mydatabasepassword';

Permissions

GRANT ALL ON mydatabase.* to 'mydatabaseuser'@'%';
FLUSH PRIVILEGES;

Access

mycli -u mydatabaseuser -p mydatabase

I'll probably update this post with more MySQL things I remember that I forget as time goes on!