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
  • 39,467
  • 16
  • 112
  • 140
Aaron
  • 4,380
  • 19
  • 85
  • 141

3 Answers3

21

Try this:

>> mysql -u USERNAME -p 

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

Zach Rattner
  • 20,745
  • 9
  • 59
  • 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
  • 4
    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
12

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
  • 634
  • 1
  • 8
  • 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,957
  • 4
  • 29
  • 37