Setting Passwords


SET PASSWORD = PASSWORD('password'); SET PASSWORD FOR user@host = PASSWORD('password'); 



When you are connected to MySQL as a regular user, use the first syntax to change your own password. If you connected as an administrator, you can change the password for another user as follows:

SET PASSWORD FOR zak@localhost =     PASSWORD('flibble'); 


In fact to change another user's password you must have the UPDATE privilege on the mysql.user table. The SET PASSWORD command is available in all versions of MySQL, but you can also modify passwords by changing values in the user table. The previous command is equivalent to the following UPDATE statement:

UPDATE user SET Password = PASSWORD('flibble') WHERE User = 'zak' AND Host = 'localhost'; 


Remember, you must issue a FLUSH PRIVILEGES command after making any changes to the user table. This is not required if you use the SET PASSWORD command.



MySQL Phrasebook. Essential Code and Commands
MySQL Phrasebook
ISBN: 0672328399
EAN: 2147483647
Year: 2003
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net