Manually editing the user table as Larry describes will work, but is not the preferred method. In particular, the new password set this way will not take effect until you either FLUSH PRIVILEGES. Using SET, as Don is trying to do, or GRANT will set the password and make it take effect immediately.

Don, mysql didn't respond because it was waiting for the ; to finish the command. Also, the parens are required. You need to enter

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');

at the mysql prompt. You should get a response like

Query OK, 0 rows affected (0.02 sec)

followed by a new prompt.

Michael

Larry Brown wrote:

try...

update user set password=PASSWORD('xxxxxx') where user='root' and
host='localhost';

(replacing the x's with the password)

Larry

-----Original Message-----
From: Don Matlock [mailto:[EMAIL PROTECTED]
Sent: Sunday, January 04, 2004 11:32 AM
To: [EMAIL PROTECTED]
Subject: RE: Help:)


Thank you very much for the prompt reply. Yes you were correct, it was the fact that the password had not been entered at all...I did the mysql -u root -p when prompted for the password I just hit enter and was able to get in.

Now I have to figure out why its not accepting the password.  I type the
following command as root in mysql:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 3.23.49-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD 'xxxxxx'

This is exactly how I typed it in...(just copied and pasted)
When I hit enter with that password...I just get a prompt...no
confirmation the password was accepted or anything.
Did I type in the command for the pass wrong?
Don

-----Original Message-----
From: Michael Stassen [mailto:[EMAIL PROTECTED]
Sent: Sunday, January 04, 2004 2:40 AM
To: robert_rowe
Cc: [EMAIL PROTECTED]; Don Matlock
Subject: Re: Help:)


robert_rowe wrote:


Issuing this command:



mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD xxxxxxxxxx

set your password to xxxxxxxxxx


I'm not so sure.  PASSWORD is a function which expects a string.  The
correct syntax is

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password')

so I don't believe this worked unless Don is misquoting what he did.


You will need to use

mysql -u root -p xxxxxxxxxx


This will not work.  You may not put a space between the -p and the
password.  The space indicates that xxxxxxxxxx is the db to use.  If you

want to provide the password on the command line (not really a good
idea), the syntax is

mysql -u root -pxxxxxxxxxx

See, no space between the -p and the password.


from the local machine to get access with the root user.

This:

mysql -u root -p

is specifying a blank password.


No, it is not.  The -p indicates you want to give a password to
authenticate.  Since you didn't provide the password on the command
line, mysql will prompt you for it.


I believe that this:

mysql -u root

will prompt you for the password without echoing it to the screen.


No.  This will try to authenticate without a password, which will only
work if the specified user (root, in this case) has no password.

Don,

I expect that when you enter `mysql -u root -p`, you get prompted for a
password and then get an error message.  It would help if you would
please post the exact text of the error message.  In the meantime, try
your old password (or no password, `mysql -u root`, if root didn't have
one before), in case the SET PASSWORD failed.

Alternatively, take a look at "How to Reset a Forgotten Root Password"
<http://www.mysql.com/doc/en/Resetting_permissions.html> in the manual
for the directions on how to use --skip-grant-tables to recover your
root mysql password.

Michael




-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]







--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to