MySQL

James Sessford - May 10 '20 - - Dev Community

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 downor 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;
Enter fullscreen mode Exit fullscreen mode

Users

CREATE USER 'mydatabaseuser'@'%' IDENTIFIED WITH mysql_native_password BY 'mydatabasepassword';
Enter fullscreen mode Exit fullscreen mode

Permissions

GRANT ALL ON mydatabase.* to 'mydatabaseuser'@'%';
FLUSH PRIVILEGES;
Enter fullscreen mode Exit fullscreen mode

Access

mycli -u mydatabaseuser -p mydatabase
Enter fullscreen mode Exit fullscreen mode

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

. . . . . . . . . . . . . . . . .
Terabox Video Player