MySQL – Reminders

Get the list of users
SELECT User FROM mysql.user;

Add new user
CREATE USER 'user'@'host' IDENTIFIED BY 'password';

Create a database
CREATE DATABASE databaseName CHARACTER SET utf8 COLLATE utf8_general_ci;
* specify the character set and also the collation. Remember that stored procedure are created with the collation the database has and it will remain the same even if you change the database collation after.

Grand all privileges to user on a specific database
GRANT ALL ON databaseName.* TO 'user'@'%';
* in production, you should maybe limit the privileges.






Leave a Reply

Your email address will not be published. Required fields are marked *