Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To make a Laravel equality lookup distinguish uppercase and lowercase characters in MySQL, use whereBinary() on a query builder that supports it: DB::table('invites')->whereBinary('token', $request->token)->first(); MySQL binary comparisons compare bytes rather than applying the usual string collation. Use a case-sensitive or binary column collation instead when the rule should apply to every comparison of that column.
How do I make a Laravel MySQL query case-sensitive?
For an equality check on a particular query, use whereBinary():
DB::table('invites')
->whereBinary('token', $request->token)
->first();
Laravel’s MySQL query grammar compiles this clause as an equality comparison with binary. The supplied value remains a bound query parameter; continue passing user input through the query builder rather than inserting it into raw SQL. See the Laravel MySQL grammar and query builder documentation.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →The method family is reported as introduced in Laravel 13.27 by Laravel News; the framework source confirms the implementation on the 13.x branch, but the exact minimum release is not established here by an official release note. Check that the installed Laravel version exposes the method before using it.
#1 Best Overall
Related equality methods
whereNotBinary()expresses inequality.orWhereBinary()andorWhereNotBinary()add the corresponding disjunctive conditions.
These method names are reported in the Laravel News coverage, so verify availability in your project’s installed framework version.
Why does binary comparison distinguish case?
For nonbinary strings such as CHAR, VARCHAR, and TEXT, MySQL applies the collation of the comparison operands. Depending on that collation, strings that differ in case—or otherwise share a sort value—may compare equal. MySQL documents that binary strings instead compare the numeric values of their bytes, making alphabetic comparisons case-sensitive. Read MySQL’s case-sensitivity documentation.
“Binary” is not simply another way to say “case-sensitive”: it means byte-sensitive. Depending on the data, the comparison can also distinguish accents or different byte sequences. That may be stricter than an application’s intended notion of case sensitivity.
Do not assume every MySQL installation has the same default collation. MySQL’s cited 26.7 manual names utf8mb4_0900_ai_ci as a default, but deployed versions, database settings, and explicit column or operand collations can differ.
Rank #3
When should the rule live in the column collation?
Use a suitable case-sensitive or binary collation on the column when all comparisons should follow that rule, rather than changing one read predicate. MySQL documents this as the way to ensure a column is always treated case-sensitively. A query-level whereBinary() is narrower: it changes the comparison for that clause.
A column collation also affects behavior beyond reads, including uniqueness. Before changing a schema, check existing values, unique constraints, and migration consequences; two values treated as distinct under one collation may collide under another. Laravel News discusses this distinction in its coverage of whereBinary().
Rank #4
Is the requirement equality or a case-sensitive pattern?
whereBinary() is for equality and inequality, not wildcard pattern matching. For a pattern lookup, Laravel’s whereLike() offers a case-sensitive option where the target database driver supports it. Consult the Laravel query documentation and confirm support for the driver you use; behavior should not be assumed to be uniform across engines.
Free tools Windows power users keep installed
One-click scans. No signup required.
Will a binary predicate use my index?
Do not infer index performance from the method name. A binary comparison may not align with an index defined under the column’s collation, but the outcome depends on the database version, schema, and query. Inspect the actual plan with EXPLAIN and evaluate it against the real workload. Laravel News discusses combining a normal indexed predicate with binary filtering as a possibility, not a guaranteed optimization; validate any such approach against your data and plan.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

