MySQL

From Computer Club Wiki

Jump to: navigation, search

MySQL

Creating accounts/database

All accounts should be created with localhost read/write access to one database only. First create the database, then grant privileges to the user. In the following example, the username will be the same as the database name. There is no need to use the command CREATE USER in this case as GRANT will do all the work of creating and granting privileges to the user.

CREATE DATABASE username;
GRANT ALL PRIVILEGES ON username.* TO 'username'@'localhost' IDENTIFIED BY 'password';

Source: http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

Personal tools