mysql启动之后马上关闭
- 120423 11:08:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
- 120423 11:08:37 [Note] Plugin 'FEDERATED' is disabled.
- 120423 11:08:37 InnoDB: Started; log sequence number 0 513471294
- 120423 11:08:37 [Note] Event Scheduler: Loaded 0 events
- 120423 11:08:37 [Note] /usr/sbin/mysqld: ready for connections.
- Version: '5.1.41-community' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
XX 12:55:49
启动之后多久关闭?
XX 12:56:16
马上
-=--------
error:
- -bash-3.00$ mysqld_safe &
- [1] 25408
- -bash-3.00$ 120423 15:50:30 mysqld_safe Logging to '/var/lib/mysql/invest-zibo.gov.cn.err'.
- 120423 15:50:30 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
- -bash-3.00$
132上的mysql:- [root@admin ~]# cat /etc/my.cnf |grep -v "#" |sed '/^$/d'
- [client]
- port = 3306
- socket = /var/lib/mysql/mysql.sock
- default-character-set=utf8
- [mysqld]
- port = 3306
- socket = /var/lib/mysql/mysql.sock
- skip-locking
- key_buffer = 16M
- max_allowed_packet = 1M
- table_cache = 64
- sort_buffer_size = 512K
- net_buffer_length = 8K
- read_buffer_size = 256K
- read_rnd_buffer_size = 512K
- myisam_sort_buffer_size = 8M
- default-character-set=utf8
- skip-federated
- log-bin=mysql-bin
- server-id = 1
- [mysqldump]
- quick
- max_allowed_packet = 16M
- [mysql]
- no-auto-rehash
- [isamchk]
- key_buffer = 20M
- sort_buffer_size = 20M
- read_buffer = 2M
- write_buffer = 2M
- [myisamchk]
- key_buffer = 20M
- sort_buffer_size = 20M
- read_buffer = 2M
- write_buffer = 2M
- [mysqlhotcopy]
- interactive-timeout
- [root@admin ~]# cat /etc/my.cnf |grep -v "#" |sed '/^$/d' |grep -i "FEDERATED"
- skip-federated
- [root@admin ~]#
--------------------------
自己解决了,需要在my.cnf配置文件中 [mysqld]后面加上 FEDERATED 参数才行。
--------------------------------------------
my.cnf文件
my.cnf是mysql的windows版的配置文件(linux下通常叫my.ini)。首先my.cnf是mysql能够运行的前提,或者更准确一点说,如果这个文件没有就位或者设置不对(一般就是basedir和datadir的路径不对),则mysql访问无法启动。
---
linux下用了很久的解压版MYSQL5,一直以为没my.cnf。
最近才知道,是可以用的,只需要把support-files下的配置文件copy到/etc/my.cnf,就可以生效了。
support-files下有my-large.cnf,my-huge.cnf,my-small.cnf等等,我这里用my-small.cnf。
引用
cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf
修改配置后,我习惯用support-files/mysql.server restart重启
我常用的配置是在[mysqld]下加下面的参数
#hx add
skip-name-resolve
max_connections=500
max_connect_errors=50000
wait_timeout=60
interactive_timeout=60
# Slow-log
long_query_time = 3
log-slow-queries=/tmp/slow_log
分别解释下:
skip-name-resolve是解决unauthenticated user问题的,如果只有本机调用,则不需要此参数
max_connections最大连接数,默认是100。
max_connect_errors最大连接错误数,默认是10,很容易出现Host is blocked because of many connection errors的问题
wait_timeout和interactive_timeout,让连接后sleep时间短一点,默认都 是28800秒
Slow-log是记录慢日志,如果不需要检查执行较慢的语句,可以不需要。
具体mysql的参数可以使用如下语句来查看
mysql>show variables;
这条语句也可以用like,比如:
mysql>show variables like '%timeout';
-----------------------------------------------------------------------------
Linux下安装完MySQL后找不到my.cnf文件原因
Linux下用rpm包安装的MySQL是不会安装/etc/my.cnf文件的,
至于为什么没有这个文件而MySQL却也能正常启动和作用,在点有两个说法,
第一种说法,my.cnf只是MySQL启动时的一个参数文件,可以没有它,这时MySQL会用内置的默认参数启动,
第二种说法,MySQL在启动时自动使用/usr/share/mysql目录下的my-medium.cnf文件,这种说法仅限于rpm包安装的MySQL,
解决方法,只需要复制一个/usr/share/mysql目录下的.cnf文件到/etc目录,并改名为my.cnf即可。
阅读(5695) | 评论(0) | 转发(0) |