XAMPP中的MySQL超时

我在Microsoft Windows Server 2003上安装了XAMPP。我在xampp / htdocs目录中有一个PHP应用程序。 我已经启动了Apache和MySQL实例。 </ p>

我注意到每天早上,当我尝试登录我的应用程序时,我的应用程序会出现MySQL错误。 在服务器上的XAMPP控制面板中重新启动MySQL实例后,这已得到修复。 我想这可能是由于超时。 如何防止超时?</ p>

这是my.ini:</ p>

  [client] 
port = 3306
socket =“D :/xampp/mysql/mysql.sock“
[mysqld]
port = 3306
socket =”D:/xampp/mysql/mysql.sock“
basedir =”D:/ xampp / mysql“
tmpdir =”D :/ xampp / tmp“
datadir =”D:/ xampp / mysql / data“
pid_file =”mysql.pid“
key_buffer = 16M
max_allowed_pa​​cket = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error =“mysql_error.log”
plugin_dir =“D:/ xampp / mysql / lib / plugin /”

skip-federated

server-id = 1

innodb_data_home_dir =“D :/ XAMPP / MySQL的/数据“
innodb_data_file_path = ibdata1中:10M:自动扩展
innodb_log_group_home_dir = ”d:/ XAMPP / MySQL的/数据“
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1 \ ninnodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_pa​​cket = 1 6M

[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
</ code> </ pre>

这是我每天早上在重启MySQL之前遇到的错误 在XAMPP上:</ p>

 警告:mysql_pconnect():MySQL服务器已经在第432行的D:\ MyApplication \ mysql.inc中消失了

警告:mysql_pconnect():链接 服务器丢失,无法重新连接到第432行的D:\ MyApplication \ mysql.inc
Fatal错误:无法连接到数据库
</ code> </ pre>
</ div>

展开原文

原文

I have XAMPP installed on Microsoft Windows Server 2003. I have a PHP application in xampp/htdocs directory. I have started the Apache and MySQL instances.

I have noticed that every morning, my application gives a MySQL Error when I try to log in to my application. This is fixed after restarting MySQL instance in XAMPP control panel on the server. I think this may be due to timeout. How do I prevent timeout?

This is the my.ini:

[client] 
port            = 3306 
socket          = "D:/xampp/mysql/mysql.sock"
[mysqld]
port= 3306
socket = "D:/xampp/mysql/mysql.sock"
basedir = "D:/xampp/mysql" 
tmpdir = "D:/xampp/tmp" 
datadir = "D:/xampp/mysql/data"
pid_file = "mysql.pid"
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
plugin_dir = "D:/xampp/mysql/lib/plugin/" 

skip-federated

server-id   = 1

innodb_data_home_dir = "D:/xampp/mysql/data"
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = "D:/xampp/mysql/data"
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
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

[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

This is the error I come across every morning before restarting MySQL on XAMPP:

Warning: mysql_pconnect(): MySQL server has gone away in D:\MyApplication\mysql.inc on line 432

Warning: mysql_pconnect(): Link to server lost, unable to reconnect in D:\MyApplication\mysql.inc on line 432
Fatal Error: Failed to connect to database

doupinyan0186
doupinyan0186 如果我没记错,相关的变量是wait_timeout,虽然你应该检查它的运行时值(你的*.ini文件甚至不会改变8小时的默认值)。无论如何,我不知道任何设置/功能使整个MySQL服务器发脾气或变得狡猾(它不会非常有用)。有可能是Windows服务器(或硬盘或其他东西)暂停了什么?
接近 5 年之前 回复
dsfdsfds521521
dsfdsfds521521 哈哈..我明白了..我也添加了错误信息..
接近 5 年之前 回复
du67560
du67560 当问题提到“错误”并且没有显示错误时,它总是让我感到害怕......
接近 5 年之前 回复
doutuo7126
doutuo7126 我添加了MySQL的my.ini。我应该显示哪些其他配置文件?或者这够了吗?
接近 5 年之前 回复
dtdr84101
dtdr84101 不,我所说的是......没有显示配置,错误和/或代码是不可能解决您的问题
接近 5 年之前 回复
drexlz0623
drexlz0623 我认为这与配置有关。你是说我应该在我的代码中加一个循环?
接近 5 年之前 回复
drhzn3911
drhzn3911 也许是无限循环?
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问