Query-Related Issues
2966
• Recompile MySQL from source to use a different default Unix socket file location. Define the path
to the file with the
--with-unix-socket-path
[121]
option when you run
configure
. See
Section 2.17.3, “MySQL Source-Configuration Options”
.
You can test whether the new socket location works by attempting to connect to the server with this
command:
shell>
mysqladmin --socket=/path/to/socket version
C.5.4.6. Time Zone Problems
If you have a problem with
SELECT NOW()
returning values in UTC and not your local time, you
have to tell the server your current time zone. The same applies if
UNIX_TIMESTAMP()
[931]
returns
the wrong value. This should be done for the environment in which the server runs; for example, in
mysqld_safe
or
mysql.server
. See
Section 2.21, “Environment Variables”
.
You can set the time zone for the server with the
--timezone=timezone_name
[248]
option to
mysqld_safe
. You can also set it by setting the
TZ
environment variable before you start
mysqld
.
The permissible values for
--timezone
[248]
or
TZ
are system dependent. Consult your operating
system documentation to see what values are acceptable.
C.5.5. Query-Related Issues
C.5.5.1. Case Sensitivity in String Searches
For nonbinary strings (
CHAR
,
VARCHAR
,
TEXT
), string searches use the collation of the comparison
operands. For binary strings (
BINARY
,
VARBINARY
,
BLOB
), comparisons use the numeric values of the
bytes in the operands; this means that for alphabetic characters, comparisons will be case sensitive.
A comparison between a nonbinary string and binary string is treated as a comparison of binary strings.
Simple comparison operations (
>=, >, =, <, <=
, sorting, and grouping) are based on each
character's “sort value.” Characters with the same sort value are treated as the same character. For
example, if “
e
” and “
é
” have the same sort value in a given collation, they compare as equal.
The default character set and collation are
latin1
and
latin1_swedish_ci
, so nonbinary string
comparisons are case insensitive by default. This means that if you search with
col_name LIKE 'a
%'
, you get all column values that start with
A
or
a
. To make this search case sensitive, make sure
that one of the operands has a case sensitive or binary collation. For example, if you are comparing a
column and a string that both have the
latin1
character set, you can use the
COLLATE
operator to
cause either operand to have the
latin1_general_cs
or
latin1_bin
collation:
col_name
COLLATE latin1_general_cs LIKE 'a%'
col_name
LIKE 'a%' COLLATE latin1_general_cs
col_name
COLLATE latin1_bin LIKE 'a%'
col_name
LIKE 'a%' COLLATE latin1_bin
If you want a column always to be treated in case-sensitive fashion, declare it with a case sensitive or
binary collation. See
Section 13.1.10, “
CREATE TABLE
Syntax”
.
To cause a case-sensitive comparison of nonbinary strings to be case insensitive, use
COLLATE
to
name a case-insensitive collation. The strings in the following example normally are case sensitive, but
COLLATE
changes the comparison to be case insensitive:
mysql>
SET @s1 = 'MySQL' COLLATE latin1_bin,
->
@s2 = 'mysql' COLLATE latin1_bin;
mysql>
SELECT @s1 = @s2;
+-----------+
| @s1 = @s2 |
+-----------+
| 0 |
+-----------+
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...