Difference between revisions of "Creating MySQL Users/Databases"
(One intermediate revision by one other user not shown) | |||
Line 7: | Line 7: | ||
Grant user database permissions: | Grant user database permissions: | ||
grant all on dataBaseName.* to userName@localhost identified by 'PASSWORD'; | grant all on dataBaseName.* to userName@localhost identified by 'PASSWORD'; | ||
+ | |||
+ | |||
+ | == Drop Users == | ||
+ | |||
+ | Drop User % | ||
+ | drop user username; | ||
+ | |||
+ | Drop User localhost | ||
+ | drop user 'username'@'localhost'; | ||
+ | |||
+ | Always flush privileges after modifying users: | ||
+ | FLUSH PRIVILEGES; | ||
+ | |||
+ | == MariaDB == | ||
+ | |||
+ | [https://www.daniloaz.com/en/how-to-create-a-user-in-mysql-mariadb-and-grant-permissions-on-a-specific-database/ User Permissions] |
Latest revision as of 15:10, 15 January 2021
Create a database user:
create user userName;
Create a database:
create database dataBaseName;
Grant user database permissions:
grant all on dataBaseName.* to userName@localhost identified by 'PASSWORD';
Drop Users
Drop User %
drop user username;
Drop User localhost
drop user 'username'@'localhost';
Always flush privileges after modifying users:
FLUSH PRIVILEGES;