content_image/725932.jpg content_image/725936.jpg
validate_password.check_user_name  system variable is enabled and the password matches the user name, VALIDATE_PASSWORD_STRENGTH()  returns 0 regardless of how other validate_password  system variables are set. 

<img src='content_image/725932.jpg'>

## 12.15 Locking Functions 

This section describes functions used to manipulate user-level locks. 

<img src='content_image/725936.jpg'>

• GET_LOCK( str , timeout ) 

Tries to obtain a lock with a name given by the string str , using a timeout of timeout  seconds. A negative timeout  value means infinite timeout. The lock is exclusive. While held by one session, other sessions cannot obtain a lock of the same name. 

Returns 1  if the lock was obtained successfully, 0  if the attempt timed out (for example, because another client has previously locked the name), or NULL  if an error occurred (such as running out of memory or the thread was killed with mysqladmin kill ). 

A lock obtained with GET_LOCK()  is released explicitly by executing RELEASE_LOCK()  or implicitly when your session terminates (either normally or abnormally). Locks obtained with GET_LOCK()  are not released when transactions commit or roll back. 

GET_LOCK()  is implemented using the metadata locking (MDL) subsystem. Multiple simultaneous locks can be acquired and GET_LOCK()  does not release any existing locks. For example, suppose that you execute these statements: 

SELECT GET_LOCK(’lock1’,10); SELECT GET_LOCK(’lock2’,10); SELECT RELEASE_LOCK(’lock2’); SELECT RELEASE_LOCK(’lock1’); 

The second GET_LOCK()  acquires a second lock and both RELEASE_LOCK()  calls return 1 (success). 

It is even possible for a given session to acquire multiple locks for the same name. Other sessions cannot acquire a lock with that name until the acquiring session releases all its locks for the name. 

