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
Programming Language: MySQL