---
title: "[MySql] Generate random string"
author: "SilverRing"
date: "2010-12-01T13:54:10Z"
tags: []
categories: ["数据库"]
slug: "mysql-generate-random-string"
draft: false
lastmod: "2010-12-01T13:54:10Z"
id: 830375
url: "https://silverring.iteye.com/blog/830375"
---

> 
> SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS password
> 


The characters are from the MD5 command (and therefore in the range a-z and 0-9).