think this will work, have not tried it:

char(int) returns a character
rand() returns a random number between 0 and 1 (with loads of decimal places)
round(int) rounds a number to a whole number.

so a random password generator could be
SELECT char(round(rand()*100), round(rand()*100), round(rand()*100), 
round(rand()*100), round(rand()*100))

maybe stick some round(rand()*100)) at the end to add some numbers to your password.

the char() will return some special characters ";'"£$" etc... so you will h ave to 
find what range they are in and adjust the rand()*100 part maybe if they are all in 
the low range you can do (rand()*100+10)



I bet someone says there is a function like randompassword() now :|

--
Dave
  ----- Original Message ----- 
  From: Michael Mason 
  To: 'MySQL Mailing List' 
  Sent: Tuesday, July 13, 2004 1:25 AM
  Subject: Auto Generation Of Passwords


  I was wondering if it's possible to create a field in a MySQL Databse that 
automatically creates unique field values for use as a password for example

   

   

  Michael Mason

  Business Support Services

  Arras® People

   

  Tel: 01706 342310

  Mobile: 07793 782287

  Fax: 01706 642754



  Member of the Recruitment Employment Confederation (00052055)

  The views expressed in this mail are entirely those of the sender, and do not 
necessarily represent the views or position of Arras Services Ltd. The information 
contained in this communication is confidential and may be legally privileged. It is 
intended solely for the use of the individual or entity to whom it is addressed and 
others authorised to receive it. If you are not the intended recipient you are hereby 
notified that any disclosure, copying, distribution or taking any action in relation 
to the contents of this information is strictly prohibited and may be unlawful. 
Neither the sender nor the represented institution is liable for the correct and 
complete transmission of the contents of this e-mail, or for its timely receipt.

   

Reply via email to