日期:2014-05-16 浏览次数:20682 次
1,安装完成后,在etc/下面增加了 my.cnf文件,再次启动mysql时报错, MySQL: mysql is not running but lock exists,经检查是my.cnf文件中 [root@localhost etc]# cat my.cnf # The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 socket = /var/lib/mysql/mysql.sock default-character-set = utf8 # The MySQL server [mysqld] port = 3306 socket = /var/lib/mysql/mysql.sock skip-locking key_buffer_size = 16K max_allowed_packet = 1M table_open_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 128K default-storage-engine=INNODB innodb_data_home_dir = /home/data/ibdata innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /home/data/ibdata default-character-set = utf8 lower_case_table_names=1 # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (using the "enable-named-pipe" option) will render mysqld useless! # #skip-networking server-id = 1 # Uncomment the following if you want to log updates #log-bin=mysql-bin # binary logging format - mixed recommended #binlog_format=mixed # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = /var/lib/mysql/ #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = /var/lib/mysql/ # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #innodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = 50 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M [mysqlhotcopy] interactive-timeout 上述中,指定的存储数据文件夹没有创建
问题2:启动系统登录时,报sql错误 原因:
linux下mysql安装完后是默认:区分表名的大小写,不区分列名的大小写;
用root帐号登录后,在/etc/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,
重启MYSQL服务,这时已设置成功:不区分表名的大小写; lower_case_table_names参数详解: lower_case_table_names = 0 其中 0:区分大小写,1:不区分大小写
?
MySQL在Linux下数据库名、表名、列名、别名大小写规则是这样的:
1、数据库名与表名是严格区分大小写的;
2、表的别名是严格区分大小写的;
3、列名与列的别名在所有的情况下均是忽略大小写的;
4、变量名也是严格区分大小写的;
?
MySQL在Windows下都不区分大小写。
3、如果想在查询时区分字段值的大小写,则:字段值需要设置BINARY属性,设置的方法有多种:
A、创建时设置: CREATE TABLE T( A VARCHAR(10) BINARY );
B、使用alter修改: ALTER TABLE `tablename` MODIFY COLUMN `cloname` VARCHAR(45) BINARY;
C、mysql table editor中直接勾选BINARY项。 按照上述修改后,成功登录