Wednesday, May 26, 2010

MySQL User Access Setup

Setting up a database to be populated by Hibernate or some other O/R mapping tool usually requires the following inital setup when working with MySQL:
  1. Create the database, e.g.

    mysqladmin -u root -p create foo

  2. Create a user and grant full access to the database from any machine, e.g.

    grant all on foo.* to 'homer'@'%' identified by 'simpson';
    grant all on foo.* to 'homer'@'localhost' identified by 'simpson';

  3. You can always undo these permissions, e.g.

    revoke all on foo.* from 'homer'@'%';
    revoke all on foo.* from 'homer'@'localhost';

Of course, there is a ton of documentation available to grant more fine-grained privileges and much more.

0 Comments:

Post a Comment

<< Home