Linux Project #3: Usefult things to know when starting with mysql.

by Gilbert Keith

1. How to create users: http://stackoverflow.com/questions/7797543/mysql-error-1227-42000-access-denied-cannot-create-user

2. How to create a database, and then USE it before you can do anything else with it: http://stackoverflow.com/questions/4005409/error-1046-no-database-selected-how-to-resolve

Ultimately, I guess, I’m trying to make this part easy.

SO to recap-

1. login as:

mysql -u root -p (then enter password);

2. use the create user command thusly:

create user ‘user_name’@’server’ IDENTIFIED BY ‘password’;

3. to grant privileges:

a. create the database as root:

create database DATABASE_NAME;

b. use the database

use DATABASE_NAME;

c. grant your newly created user all the privileges.

grant all privileges on DATABASE_NAME.* to ‘user_name’@’server’ WITH GRANT OPTION;

 

Edit: in step 3C there needs to be a * to grant privileges for all tables. how silly of me to not realize that!

Advertisements