Thursday, February 17, 2005
4. Define user privileges
Right, in the last segment I created the contactDB database using "ab1234" with password "A1234567". Now I'm going to create some users and give them privileges...
COMMENT: First off I try to define the user permissions using "ab1234"
C:\mysql\bin>mysql -uab1234 -pA1234567
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 4.0.17-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> GRANT ALL ON contactDB.* TO supercontact@'localhost' IDENTIFIED BY 'A1234567';
ERROR 1044: Access denied for user: 'ab1234@localhost' to database 'contactDB'
mysql> exit
Bye
COMMENT: That doesn't work so maybe we do have to be logged in as root to create users and define privileges? Try again, this time logged in as root...
C:\mysql\bin>mysql -uroot -pA1234567
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 4.0.17-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> GRANT ALL ON contactDB.* TO 'supercontact'@'localhost' IDENTIFIED BY 'A1234567';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT SELECT ON contactDB.* TO 'simpleuser'@'localhost' IDENTIFIED BY 'A1234567';
Query OK, 0 rows affected (0.00 sec)
mysql>
COMMENT: No complaints, created users and defined privileges successfully as the root user...
Back to DB Manager to check the users are there...yes! (you can make your own screen shot!)5. create tables in contactDB
COMMENT: First off I try to define the user permissions using "ab1234"
C:\mysql\bin>mysql -uab1234 -pA1234567
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11 to server version: 4.0.17-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> GRANT ALL ON contactDB.* TO supercontact@'localhost' IDENTIFIED BY 'A1234567';
ERROR 1044: Access denied for user: 'ab1234@localhost' to database 'contactDB'
mysql> exit
Bye
COMMENT: That doesn't work so maybe we do have to be logged in as root to create users and define privileges? Try again, this time logged in as root...
C:\mysql\bin>mysql -uroot -pA1234567
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 4.0.17-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> GRANT ALL ON contactDB.* TO 'supercontact'@'localhost' IDENTIFIED BY 'A1234567';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT SELECT ON contactDB.* TO 'simpleuser'@'localhost' IDENTIFIED BY 'A1234567';
Query OK, 0 rows affected (0.00 sec)
mysql>
COMMENT: No complaints, created users and defined privileges successfully as the root user...
Back to DB Manager to check the users are there...yes! (you can make your own screen shot!)5. create tables in contactDB