Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL password consistency

Tags:

mysql

In MySQL 5.1 when I type:

select Password('test123');

I get password as 41 bytes long. The same, when typed in older MySQL versions, is 16-bytes long. I need to store 16-byte long passwords, so is there any way to specify length (16-bytes) while retrieving/encrypting the password?

like image 368
Sharpeye500 Avatar asked Jun 24 '10 19:06

Sharpeye500


People also ask

Is MySQL password case sensitive?

Is MySQL varchar case sensitive? The CHAR and VARCHAR types are not case sensitive by default, but may be declared as BINARY to make them case sensitive. ENUM , SET , and TEXT columns are not case sensitive.

What is the best data type for password in SQL?

Use the SQL data type CHAR(60) to store this encoding of a Bcrypt hash. Note this function doesn't encode as a string of hexadecimal digits, so we can't as easily unhex it to store in binary. Other hash functions still have uses, but not for storing passwords, so I'll keep the original answer below, written in 2008.

What is the default MySQL password?

The default user for MySQL is root and by default it has no password. If you set a password for MySQL and you can't recall it, you can always reset it and choose another one.


1 Answers

They changed hashing schemes at one point, but you can still use the old one, it's just named OLD_PASSWORD now:

SELECT OLD_PASSWORD('test123');
like image 133
Michael Mrozek Avatar answered Sep 23 '22 00:09

Michael Mrozek