Adding MySQL users

Applies to: MySQL

This article assumes the user has successfully installed MySQL and the MySQL GUI tools as described in the article Installing MySQL

Although MySQL Administrator is used in this discussion there are many other alternatives for interacting with the MySQL database. A web search will find numerous third party utilities while users familiar with MySQL may prefer to use the command line.

MySQL users

Installing MySQL creates a default user account - 'root'. The root account is the most fundamental or privileged MySQL user and is generally only used by the person who maintains and administers the MySQL server. Operators involved in the day to day running of MySQL applications (such as Timestone Software Version 4) usually connect with a different user account that gives them only enough privileges to run the software while restricting them from potentially harmful privileges such as DROP (where users, tables or even the entire database be deleted).

In this article the root account shall be used to launch the MySQL Administrator and create another user account with more limited privileges.

Launching MySQL Administrator

MySQL Administrator is launched by running this file:

C:\Program Files\MySQL\MySQL Tools for 5.0\MySQLAdministrator.exe

Figure 1: The MySQL Administrator connection window

Note the use of the root user account in the above screen grab. This is needed in order to have sufficient privileges to create and modify additional users

Add a user

Once the MySQL Administrator has launched perform the following steps to add a user.

  1. Select the User Administration object on the left hand side of the MySQL Administrator window. The root account should already be listed in the Users Accounts list in the lower left
  2. Click 'Add new user'
  3. Enter a MySQL username and password and click 'Apply changes'. The new user is added to the Users Accounts list

Figure: Adding a new user account.

In the example above the user has been created with the name 'timestone but the choice of name is entirely arbitrary'

Where the user can connect from

By default new users (including the root user) can connect from any host computer. It is possible to restrict the computers from which a user can connect from (the host computer). Although many people make use of the added security this step provides, its implementation is optional and at the user's discretion. Once a host has been added the user can only connect from the computer(s) specified.

  1. In the Users List, right click the user created above and select 'Show hosts in user list'
  2. Repeat the previous step and select 'Add host from which user can connect'
  3. Enter an IP address.

Figure 2: Adding a host computer for a user

Note the use of the % wildcard which can be used in any of the ip address parts

Granting privileges to a user

As mentioned earlier the root user account should have all privileges. However the Timestone Software operators using Version 4 programs at the workstations do not need all MySQL privileges and for security purposes it is available to grant such users sufficient privileges to run the software only.

  1. Select the user in the user list and, if defined, the host from which they can connect from
  2. Select the Schema Privileges tab
  3. Select the timestone database from the Schemata list
  4. From the list of Available Privileges assign the user the following privileges
    • Select
    • Insert
    • Update
    • Delete
    • Execute
  5. Click Apply changes to assign the privileges

End of article