How do I create a MySQL user and grant them permission to a certain database?

In Telnet/Shell type: "mysql

This will load the mysql command line. Next type: 

GRANT ALL PRIVILEGES ON [database].* TO [username]@[domain] IDENTIFIED BY '[password]'; 

(where "[database]" is the database you created earlier, [username] is the mysql username you want, [domain] is the domain you'll be connecting from (usually 'localhost') and [password] is the password you'd like to use. Be sure it's enclosed in 's. 

For example: 
GRANT ALL PRIVILEGES ON mydatabase.* TO bob@localhost IDENTIFIED BY 'fruitfly';

Was this answer helpful?

 Print this Article

Also Read

What is PHP?

Self-referentially short for PHP: Hypertext Preprocessor, an open source, server-side, HTML...

Troubleshooting \"Cannot connect to the database\" errors...

Here are a few initial things (common mistakes) to take a look at: - Make sure...

What is the number of maximum connections allowed to a single MySQL database?

Connecting to MySQL through PHP...

  Use the following outline to connect and begin querying the MySQL server from within your...

How to I create a MySQL Database?

To create a mysql database, log into your control panel and select the 'MySQL Databases' link....