Results 1 to 3 of 3
Thread: MySQL 4.1.13 case-sensitivity
Mar 12, 2006, 00:30 #1
MySQL 4.1.13 case-sensitivity
I'm writing a simple query in MySQL 4.1.13 comparing a string with a VARCHAR field using LIKE:
SELECT * FROM products WHERE products_model LIKE 'bk052-rt'
SELECT * FROM products WHERE products_model LIKE 'BK052-RT'
From what I've seen and learned, VARCHAR fields are not case-sensitive. I thought the problem might be collation-related, so I switched from latin1 to utf8, but the results are the same.
Anyone know if MySQL is case-sensitive across all field types is this version? I couldn't find any docs confirming it, but it sure seems like it.
Last edited by ThetaWaveRider; Mar 12, 2006 at 14:27.
Mar 12, 2006, 19:20 #2
- Join Date
- Feb 2004
- Tampa, FL (US)
- 1 Post(s)
- 0 Thread(s)
what specific collation are you using? utf8_bin is going to be case-sensitive since it's a binary collation. if you want case insensitive, then you need a collation that ends in _ci. also, once you change the collation, you need to rebuild your indexes. the mysql manual reccommends a repair index, but on large datasets, droping the index and recreating it is faster.
Mar 12, 2006, 22:31 #3
Yes, that's the ticket. I failed to mention that both collations are binary. I followed your advice and rebuilt the indexes after changing collations, and all is well now. Thanks.