MySQL workbench is a windows GUI software agent used to administrate MySQL servers and databases, and is often installed by default on a windows server running MySQL, however you can also install it remotely on a client or developer machine. This tutorial illustrates how to create a new database and a new user to access that database on a MySQL Server using phpMyAdmin.
- You will require a root or DBA user login to the MySQL server, or a user login with permission to create new databases.
- MySQL servers are usually configured to NOT allow a root user login from a remote host. You will need to first create a DBA user login, or use MySQL Workbench locally installed on the Mysql Server.
- You will need to have MySQL workbench installed. To download the latest version click here.
Using Mysql Workbench Version 5.2
Open the MySQL Workbench software.
DOUBLE-Click on your MySQL instance under the SQL Development
section of Workbench to create a new schema.
NOTE: Databases are called schema's in MySQL Workbench.
MySQL workbench may require a login to your MySQL server. Enter your root or user and password that has been assigned dba server privileges.
Click on the New Schema
icon in the menu, and then enter a name
for your new database in the field as shown. Click the Apply
button to generate the SQL script.
Click the Apply
button again to execute the create database statement, and create your new database.
Your database should now be listed on the left with your other database schemas.
Click the Home
icon in the top left corner to return to the Workbench Central screen. Click on your MySQL server instance under the Server Administrator
section of MySQL workbench to create a new database user and assign privileges to your new database.
Click on Users and Privileges
. Then click on Add Account
. Enter a login name
for the new user, type localhost
and a new password
as shown. Click Apply
to create the new user account.
To assign privileges for this user to access a specific database, click on the Schema Privileges
tab. Click the user account
from the list of users on the left. Click the Add Entry
Select the Selected Schema
radio option, and choose your database schema from the list.
Select the appropriate privileges to allow the user access to the selected database. Most modern website software will only require the permissions listed below. Click Save Changes to complete your new user setup.
Select, Insert, Update, Delete, Create, Alter, Index, Drop, Create Temporary Tables, Lock Tables
You can now test your new user login by using MySQL Workbench with your newly created user account.