Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie question - how do I add a user

Status
Not open for further replies.

dognobbler

Programmer
Jul 4, 2003
46
GB
Hello All, sorry for asking a newbie question. I have checked the MySQL manual but I just find it terribly confusing.

I have just installed MySQL and what I would like to do is add a user that has all permissions on all database. At the moment I am logging in by going to directory

mysql/bin

and typing mysql.

So I am not sure whether I am logged in as the correct type of user to be able to add other users.


I hope that is enough info for you to be able to help me or point me in the rigt direction. Thanks.

Andy
 
AFter you log in issue a GRANT command


GRANT ALL
ON *.*
TO root@'localhost'
IDENTIFIED BY "yourpassword"
WITH GRANT OPTION
;


This command will give all rights to the user Root connected from localhost.

If you want to give all rights from all hosts

GRANT ALL
ON *.*
TO root@'%'
IDENTIFIED BY "yourpassword"
WITH GRANT OPTION
;


Bye

Qatqat

Life is what happens when you are making other plans.
 
When I entered the command you gave me I got the following error:

ERROR 1045: Access denied for user: '@localhost' (Using password: NO)

Any ideas what I am doing wrong.

Thanks for the help

Andy
 
I sorry but like I said I am a newbie. I followed the instructions given and entered

GRANT ALL
ON *.*
TO root@'localhost'
IDENTIFIED BY "yourpassword"
WITH GRANT OPTION
;

and

GRANT ALL
ON *.*
TO root@'localhost'
IDENTIFIED BY ""
WITH GRANT OPTION
;

and both time got the same error saying

ERROR 1045: Access denied for user: '@localhost' (Using password: NO)

I have not yet set up any usernames and password for anyone including root. When I login I am doing it anonymously.

Any help you can give would be much appreciated.

Andy
 
Let me rephrase my last question. Please read the questions carefully, because I'm asking some very specific questions and need some very specific answers. I do not need you to tell me how you created the user -- I already understand that part.
[ul][li]In order to get that error, you must have run some program. What program gave you that error, and how did you start that program?[/li][li]Did you get that error while trying to create the new user, or when trying to log in as the new user you just created?[/li][/ul]
The error you describe can come from many sources. For example, if you use the &quot;IDENTIFIED BY&quot; clause of a GRANT query, you create a user which must provide a password to use the system. If you then attempt to invoke the &quot;mysql&quot; command-line SQL query app but don't give it the password (using the &quot;--password=<yourpassword>&quot; command-line parameter) or you don't tell the &quot;mysql&quot; command-line SQL query app to ask you for your password (using the &quot;-p&quot; command-line parameter), then &quot;mysql&quot; will attempt to login with out giving the MySQL server a password. You will then get that error.

It may well be that the user has been correctly created, but that you are using that user's credentials incorrectly. Without knowing what you did to get the error, it's difficult to advise you.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
when you installed mysql it should have asked you to create a root user, did it not ask you? is the traffic light running?

To err is human, to completely mess up takes a computer. [morning]
 
Your error ERROR 1045: Access denied for user: '@localhost' (Using password: NO)
indicated that there is no user.
After running mysql, use `SELECT USER()` to see if you are root. Judging from your error, it should output ODBC@localhost

To rectify, run MySQL by executing `mysql -u root -p`
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top