CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 [RESOLVED] Password field in MySQL database is not case sensitive

Print topic Send  topic

Author Message
rado

Posts: 221
Posted: 04/28/2009, 3:39 PM

I know that table and field names are case sensitive in MySQL database, however after long time I realized that the value in my user_password field is not.
Do you know how I can configure mysql db to set my password field to have case sensitive values. This is not the question for PHP forum , but I know that here is so many smart people that could answer my question.

Thanks,
Rado
View profile  Send private message
damian

Posts: 838
Posted: 04/28/2009, 3:45 PM

i believe that this is done by setting the BINARY attribute on your password field in the database...

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
melvyn


Posts: 333
Posted: 04/28/2009, 4:49 PM

That's done setting that field collation as Case Sensitive. By default they're as latin1_sweedish_ci (or whatever character set you're using) and set it without _ci.

ALTER TABLE mytable CHANGE my_field VARCHAR( 45 ) CHARACTER SET latin1 COLLATE latin1_general_cs NULL DEFAULT NULL   

The above will be latin1_general_cs = Case Sensitive.

ALTER TABLE mytable CHANGE my_field VARCHAR( 45 ) CHARACTER SET latin1 COLLATE latin1_spanish_ci NULL DEFAULT NULL   

Tha above will set as Spanish Case Insenstive.

I remember it from a time, long time ago in a post from Walter Kempess.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
rado

Posts: 221
Posted: 04/28/2009, 7:44 PM

Thanks damian and Melvyn.

I run this statement:
ALTER TABLE tenants CHANGE tenant_Password VARCHAR(50) CHARACTER SET latin1 COLLATE latin1_general_cs NULL DEFAULT NULL 

and got this error:
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(50) CHARACTER SET latin1 COLLATE latin1_general_cs NULL DEFAULT NULL' at line 1

I was able to change the charset to "cs" using MySQL Admin, however it applies to whole table, which is not practical in my case.

Rado
View profile  Send private message
rado

Posts: 221
Posted: 04/28/2009, 8:00 PM

And this one worked:

ALTER TABLE `tenants` MODIFY `tenant_Password` varchar(50) COLLATE `latin1_general_cs`;

Thanks a lot for respond and help.

Rado
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.