This snippet shows how to create a new database and user with assigning permissions of the newly created database to the user. In this example I use database name as user name for clarity and consistency.
Source code viewer
- GRANT ALL PRIVILEGES ON `database_name`.* TO 'database_name'@'localhost';Programming Language: MySQL