14

I created a different user, when I try to log into mysql it will not let me. I think I am missing a step. I am using windows 7. When I log in it automatically asks me for a password. If I enter the root password I can use mysql. If I enter the password I have created for the user, I get an error I cannot read and the program exits. Do I need to first login as root then somehow log in as new user. I am very confused. The code I used to create the new user is here:

Trouble logging into mysql as non root

codeforester
  • 34,080
  • 14
  • 96
  • 122
Aaron
  • 4,042
  • 14
  • 76
  • 131

3 Answers3

21

Try this:

>> mysql -u USERNAME -p 

Press enter, and you'll be prompted for the password for USERNAME.

Zach Rattner
  • 19,821
  • 9
  • 55
  • 82
  • mysql>mysql -u bookorama -p, when I hit enter it goes to the next line, when I put a ; at the end I get an error – Aaron Apr 16 '11 at 23:28
  • Oh, don't do this in the mysql prompt; do it in the command prompt. – Zach Rattner Apr 16 '11 at 23:31
  • 1
    is there a way to do this in mysql prompt? – Aaron Apr 16 '11 at 23:33
  • 3
    Figured it out, when I downloaded mysql I needed to check the box allowing commands from the command line, then I type mysql -h hostname username -p. hit enter and I am in mysql as a new user. Thanks you for the help – Aaron Apr 17 '11 at 15:18
11

There is no mysql equivalent to Oracle's 'connect' statement in the sense that allows to switch a user once already logged in to a mysql console session.

Tom Silverman
  • 574
  • 1
  • 7
  • 7
1

You may have created the new user, but not given that user sufficient permissions on the database you're trying to manage.

dj_segfault
  • 11,701
  • 4
  • 27
  • 35