DelphiFAQ Home Search:
General :: Databases :: mysql
General information about mysql - how to get around the differences between version 3.33 an 4, how to do stuff that you think you need a nested query for etc.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Setting a user password in mysql (Why do I get 'Access denied')

Question:

I updated a user's password in the mysql system table mysql.user and the user gets an error message 'Access denied'. What am I doing wrong?

Answer:

Did you update the password field directly as shown in the example below? That won't work. The password field has to be updated using the password() function which encrypts the string.

Don't forget to reload with mysqladmin afterwards to make the authentication take effect.

/* switching to system db */
 use mysql;
 
 /* trying to change all passwords to 'default': */
 
 /* this does not work */
 update user set Password = 'default';
 
 /* this is how it is done */
 update user set Password = PASSWORD('default');
 flush privileges;
 
 /* from the command line: */
 mysqladmin -uroot -pdefault reload 

Generated 12:00:31 on Jul 17, 2018