nerdegutta.no
SQL: To remember
18.06.26
Programming
Things I usually forget....
Add a user to mySQL:
This creates a new user:
CREATE USER 'USERNAME'@'localhost' IDENTIFIED BY 'STRONG_PASSWORD';
GRANT ALL ON 'DATABASENAME'.* TO 'USERNAME'@'localhost';Here is exactly what each part means:
FLUSH PRIVILEGES;The FLUSH PRIVILEGES command instructs the MySQL server to reload the grant tables (mysql.user, mysql.db, etc.) from disk into the server's in-memory privilege cache. This forces any recent modifications made to user permissions to take effect immediately without needing to restart the database server