MySQL Workbench: Creating and Managing Databases and Users

Creating a New Database

  1. Select Database > Connect to Database in the navigation bar:

  1. If you’re connecting from the server the MySQL instance is running on, you can use 127.0.0.1 or localhost as the Hostname. Otherwise, you’ll use the IP of the server host.

    You can connect with any existing MySQL user, but they’ll need to have the Create privilege to make a new database. In a fresh installation, or if there are no other users with the Create privilege, you’ll need to sign in as the root user.

  1. Once you’re connected, simply use the button below to create a new schema (for our purposes here, a schema is functionally a new database). From there, just provide a name for the new schema and click Apply.

  1. Once you click Apply, you’ll be prompted to review the SQL script to create the schema. Simply select Apply, then Finish.

Congratulations, you’ve successfully created a new database!

Creating a New User

  1. When connected to a database, you can create a new user by navigating to Server > Users and Privileges

  1. From there, click Add Account to make a new user, providing a username and password.

    Please note that the Limit to Hosts Matching field is set to a wildcard by default, allowing a connection from any IP. If you’re only connecting to the database from the localhost, then this can be set to 127.0.0.1. If you’re connecting from one or more specific IPs, then you can provide them here to allow external connection limited to those IPs.

3a. Finally, you can assign the user to specific schemas in the Schema Privileges tab.

3b. If you want to create another administrator-level user, you can instead assign privileges to the user under the Administrative Roles tab.

Congratulations! You’ve now created a new user to go with that new database.