MySQL users cannot exist separately from MySQL databases. You must stick to the following sequence:
- Create a database
- Add MySQL users to each created database.
However, MySQL users can be shared by different databases.
To create a MySQL database, do the following:
- Select MySQL in the Databases menu and MySQL DB creation Wizard automatically appears.
- On the form that shows enter the name of the database and database description if needed:
new MySQL databases are created with the username_ prefix, where username is a unique identifier that contains either first letters of the name of an account under which this database is created, or that account name's first letters and a unique number if there are several account names starting with the same letters. This is done to prevent the creation of databases with the same name under different users.
- Agree with additional charges if any.
- In the form that appears, create a new user or grant privileges to users of other databases:
- Add a new user to the database you have just created. User roles are explained next. Click Add user.
- Choose roles for users of other databases so they can use your new database. Click Grant.
- Each user role involves a fixed set of privileges on this specific database:
Role: Set of privileges: read select read/write select, insert, delete, update dba select, insert, update, drop, create, alter, index
- Click Finish to complete creating your MySQL database.