adding users in mySQL

You can use the Grant commands (check out the MySQL documentation at http://www.mysql.com/doc/en/GRANT.html it is very helpful).

A typical grant would be:

grant all;
on *;
to uoba identified by 'password123';
with grant options;


It is quite reasonable to learn all this in the command line first (develops your mysql raw skills), but if you want the short n' easy way, checkout phpmyadmin (do a search for it on http://versiontracker.com/macosx/ )

I can't remember if you can issue users from the mysqladmin command either, anyone?
 
now, if I could totally understand what GRANT and REVOKE technical details mean....
BTW, I am new to SQL, but am going to learn SQL Server(MS) and I have mySQL installed in my PowerMac

thanks anyways
 
Sorry...

Grant all, means to grant all user options to the user (you can substitute this with just the options needed, as Grant select, insert, update etc.)

on *, means on any database (again, can be substituted with the actual database name).

to uoba identified by 'password123', is the name of the user and the password (make sure the password has the quote marks).

With Grant Options, means to allow the user to grant privileges to other users.

;)
 
There is another -perhaps more complicated - way to addusers and/or permission(s). When you are using mysql in the commandline try show databases as in the following example.

mysql> show databases;
+------------+
| Database |
+------------+
| jsp_test |
| log_access |
| mattie |
| mysql |
| test |
+------------+

You should see a mysql database in the outputted info. I believe this is installed automatically. Now connect to mysql database.

mysql> \u test
Database changed

Use show tables to checkout the tables in the database. You will find a user table that you can manipulate directly.

mysql> show tables;
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv |
| db |
| func |
| host |
| tables_priv |
| user |
+-----------------+

You can use insert to add data to user, and you can use update to change the data you have already entered into the table:

insert into user (Host, User, Password, Select_priv, Insert_priv, Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv, Shutdown_priv,Process_priv,File_priv, Grant_priv, References_priv, Index_priv,Alter_priv) values ('localhost', 'admin', '', 'Y', 'Y', 'Y','Y', 'Y', 'Y','Y', 'Y','Y','Y', 'Y', 'Y', 'Y', 'Y')
 
Back
Top