I set lower_case_table_names = 2
在 my.cnf 文件中。设置变量后,我重新启动了 mysql 服务器,但当我使用时,该值仍然是 0SHOW VARIABLES
.
我正在使用 MySQL 5.5。任何想法还需要做什么?
UPDATE
my.cnf 位于/etc
and /etc/mysql
(ubuntu操作系统)
内容:-
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
lower_case_table_names = 2
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
最明显的可能性:
- 错误于my.cnf-- 我需要准确查看您的 my.cnf 文件中的内容
-
my.cnf位置错误
- mysql服务器不读取my.cnf因为命令行设置
- mysql 服务器覆盖来自的设置my.cnf通过命令行设置
显示你的内容my.cnf文件,它的路径是什么,以及如何重新启动服务器,我将详细说明我的答案。
UPDATE:您不应在 UNIX(或具有区分大小写的文件系统的任何系统)上使用值“2”
从手册(http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html):
如果您仅在一种平台上使用 MySQL,则通常不需要
改变小写表名变量的默认值。
然而,如果你想转移表,你可能会遇到困难
文件系统区分大小写不同的平台之间。为了
例如,在 Unix 上,您可以有两个不同的表,名为my_table and
MY_TABLE,但在 Windows 上这两个名称被认为是相同的。到
避免数据库字母大小写引起的数据传输问题或
表名,您有两个选择:
Use 小写表名=1在所有系统上。主要缺点
这是当你使用显示表格 or 显示数据库, 你做
看不到原始字母大小写的名字。
Use 小写表名=0 on Unix and 小写表名=2 on
Windows。这会保留数据库和表名称的字母大小写。
这样做的缺点是你必须确保你的陈述
始终使用正确的名称引用您的数据库和表名称
Windows 上的字母大小写。如果您将语句传输到 Unix,其中
字母大小写很重要,如果字母大小写很重要,则它们不起作用
不正确。
例外: 如果您正在使用InnoDB表和你试图避免
这些数据传输问题,你应该设置小写表名 to
1在所有平台上强制名称转换为小写。
你想达到什么目的?为什么要设置为2呢?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)