 |
 |
Create New User in MySQL
|
 |
|
 |
|
Junior Member
Join Date: Jul 2002
Location: na
Status:
Offline
|
|
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
|
|
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
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jul 2002
Location: na
Status:
Offline
|
|
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
|
|
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
|
|
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...
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jul 2002
Location: na
Status:
Offline
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|