5.7.4をちょこちょこいじっていてふと気付いた。
$ cat ~/.mysql_secret
# The random password set for the root user at Tue Sep 16 18:33:14 2014 (local time):
9dl}uOS35]s4pAa3
…あれ、なんか桁数とバリエーション増えてない?;
358 sub generate_random_password {
359 # On (at least) Linux and Solaris, a "random" device
is available, use it:
360 # cat /dev/urandom | LC_ALL=C tr -dc "[:alnum:]" |
fold -w 8 | head -1
361 # Without LC_ALL, "tr" may not know the "alnum"
character class -
362 # and there are user profiles which do not have this
set.
363 #
364 my $password = `cat /dev/urandom | LC_ALL=C tr -dc
"[:alnum:]" | fold -w 8 | head -1`;
365 chomp ($password);
366 return $password;
367 }
…