Tech Site & Blog Blog about technology & programming

Posts Tagged database


24Sep/091

MySQL Add User

The simplest way to add user to MySQL and grant privileges for specific database.

1. Open terminal and type "mysql -u root -p" to start MySQL client and use your root account to connect to database.

2. Type "create database my_database;" to create a database with name my_database.

3. Type:
GRANT ALL PRIVILEGES
ON my_database.*
TO 'my_user'@'localhost'
IDENTIFIED BY 'my_password'
WITH GRANT OPTION;

With this command you've created a user with name my_user and password my_password with all privileges on my_database.