List:General Discussion« Previous MessageNext Message »
From:<mysql Date:November 9 2002 8:28am
Subject:wait_timeout
View as plain text  
 Greeting to all. Here is some data on my server :

[student:99] /usr/local/bin> mysqladmin -u root -p version
9:18
Enter password: *******
mysqladmin  Ver 8.23 Distrib 3.23.52, for hp-hpux11.00 on hppa2.0w
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          3.23.52-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /student1/mysql/mysql.sock
Uptime:                 6 min 31 sec

Threads: 1  Questions: 8  Slow queries: 0  Opens: 7  Flush tables: 1  Open
tables: 1 Queries per second avg: 0.020
[student:100] /usr/local/bin>
9:18

 I am writing a unix deamon for email processing that uses this mysql
server. I got a "MySQL error: MySQL server has gone away" error. I figured
the reason was that my connection timed out. This was because my deamon
opens the connections it needs at startup and uses them throughout its
lifetime, thus causing "gone away" error. I saw 2 fixes for this.

1. Increasing wait_timeout value. How should i do this so that it is
set to the new value every time i start the server?

2. Opening and closing a mysql connection each time I need to execute
a query. Is this a good way to do things, or should I prefer the above
method?

One more question. I moved mysql.sock file from /tmp to protect it from
beeing deleted by admins when system is cleanedup. It is now located in
/student1/mysql/ directory. I changed all relevant paths in /etc/my.cnf
file but still when I issue `mysql` on the command line it complaints
about beeing unable to find "/tmp/mysql.sock", only
"mysql --socket=/student1/mysql/mysql.sock" works. Why?

 Here is my.cnf :

# Example mysql config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# a important part and systems up to 128M very MySQL is used together with
# other programs (like a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/var) or
# ~/.my.cnf to set user-specific options.
#
# One can in this file use all long options that the program supports.
# If you want to know which options a program support, run the program
# with --help option.

# The following options will be passed to all MySQL clients
[client]
#password       = your_password
port            = 3306
socket          = /student1/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306
socket          = /student1/mysql/mysql.sock
skip-locking
set-variable    = key_buffer=16M
set-variable    = max_allowed_packet=1M
set-variable    = table_cache=64
set-variable    = sort_buffer=512K
set-variable    = net_buffer_length=8K
set-variable    = myisam_sort_buffer_size=8M
log-bin
server-id       = 1

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#set-variable   = bdb_cache_size=4M
#set-variable   = bdb_max_lock=10000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/var/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/var/
#innodb_log_arch_dir = /usr/local/mysql/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#set-variable = innodb_buffer_pool_size=16M
#set-variable = innodb_additional_mem_pool_size=2M
# Set .._log_file_size to 25 % of buffer pool size
#set-variable = innodb_log_file_size=5M
#set-variable = innodb_log_buffer_size=8M
#innodb_flush_log_at_trx_commit=1
#set-variable = innodb_lock_wait_timeout=50

[mysqldump]
quick
set-variable    = max_allowed_packet=16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
set-variable    = key_buffer=20M
set-variable    = sort_buffer=20M
set-variable    = read_buffer=2M
set-variable    = write_buffer=2M

[myisamchk]
set-variable    = key_buffer=20M
set-variable    = sort_buffer=20M
set-variable    = read_buffer=2M
set-variable    = write_buffer=2M

[mysqlhotcopy]
interactive-timeout

 Thank you for any and all help, and I loved mysql so far.

	Vlatko

Thread
wait_timeoutmysql9 Nov