Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Create New User in MySQL

Create New User in MySQL
Thread Tools
Junior Member
Join Date: Jul 2002
Location: na
Status: Offline
Reply With Quote
Feb 2, 2003, 07:36 AM
 
Hi,
I am a newbie to mysql. I have just installed the package and would like to experiment it a bit. So far, I think the default users created are root and mysql. And the only database created in MySql. Using user mysql, i am not able use the MySql database. Anyhow, I would like to create a new user and a new database. How can I do it?

I have looked through the reference material, but the Grant option does not seem to work. Do I need to create user in the OSX User Account first??

Thanks
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Feb 2, 2003, 11:56 AM
 
Originally posted by kymikai:
I have looked through the reference material, but the Grant option does not seem to work. Do I need to create user in the OSX User Account first??
did you read through this? if not, that might help. there's more info on setting up mysql here. i hope one of those helps
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
kymikai  (op)
Junior Member
Join Date: Jul 2002
Location: na
Status: Offline
Reply With Quote
Feb 3, 2003, 11:26 AM
 
Thanks, I did try one of the example:
mysql --user=root mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

but got the following result
Query OK, 0 rows affected (0.00 sec)


I replaced monty with one of users already setup on my pb. But as 0 rows affected, I don't think it worked.

Just to be sure, to add a new user to mysql, I should
(1) create a new user in my PB
(2) then run the above command?

Not sure what I am missing.

Thanks
     
Junior Member
Join Date: Nov 2000
Location: Tallinn, Estonia
Status: Offline
Reply With Quote
Feb 3, 2003, 03:24 PM
 
Originally posted by kymikai:
Thanks, I did try one of the example:
mysql --user=root mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

but got the following result
Query OK, 0 rows affected (0.00 sec)


I replaced monty with one of users already setup on my pb. But as 0 rows affected, I don't think it worked.

Just to be sure, to add a new user to mysql, I should
(1) create a new user in my PB
(2) then run the above command?

Not sure what I am missing.

Thanks
Query OK, 0 rows affected is normal behaviour for GRANT, there must be some other problem.
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Feb 3, 2003, 05:56 PM
 
Originally posted by kymikai:
Just to be sure, to add a new user to mysql, I should
(1) create a new user in my PB
(2) then run the above command?

Not sure what I am missing.

Thanks
By PB do you mean your PowerBook? If so, then don't worry about is. The only reason you would need to create a new user in Mac OS X for MySQL is the one that will be running the process.

The problem you've got is that you have granted access to 'monty@localhost' without having created that user first.

To add new users to MySQL, you need to open the mysql program and enter the following into the command line:

USE mysql;

INSERT INTO user VALUES ('localhost','monty',PASSWORD('z1y2x3'),'Y','Y','Y ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

That will create a 'superuser' with access privileges to everything that MySQL has to offer. Obviously change the password to the one your prefer.

Now exit mysql shell. You should be able to restart the shell from the terminal with:

mysql -umonty -pz1y2x3

A great book to learn more is SAMS' Teach yourself MySQL in 24 hours. It's a straightforward read, and since the copy is a few years old (the principles and basic syntax are still the same, though) you can pick it up for $10-$20.
Computer thez nohhh...
     
kymikai  (op)
Junior Member
Join Date: Jul 2002
Location: na
Status: Offline
Reply With Quote
Feb 3, 2003, 08:43 PM
 
Great! Thank you. It seems to be doing something towards the right direction but still many unanswered questions. I think I will just pick up a mysql book.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:09 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2