简体   繁体   中英

Laravel MySQL PDO “Server has gone away” on WAMP

I'm trying to migrate our database into MySQL using WAMP on Windows 10, but I'm getting a PDO exception that the "Server has gone away". I'm running the standard migrate command:

php artisan migrate --seed

However, when the migrate gets to a ~4MiB file it chokes with the following error:

[ErrorException]
PDO::exec(): MySQL server has gone away

This migrate has worked on other machines, so I'm a bit confused. My MySQL my.ini file looks like this:

[client]
port        = 3306
socket      = /tmp/mysql.sock
reconnect   = true

[wampmysqld]
port        = 3306
socket      = /tmp/mysql.sock
key_buffer_size = 64M
max_allowed_packet = 512M
sort_buffer_size = 8M
net_buffer_length = 256K
read_buffer_size = 4M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=c:/wamp/bin/mysql/mysql5.6.17
log_error=C:\wamp\logs\mysql.log
datadir=c:/wamp/bin/mysql/mysql5.6.17/data

wait_timeout = 84600
interactive_timeout = 84600

When I run the individual SQL files through PhpMyAdmin, everything runs fine. Could this be a WAMP problem, as my colleague has successfully migrated using XAMPP and he has the same amount of RAM

This turned out to be a misconfiguration of WAMP. The config file wasn't being loaded correctly until the [sqld] section was renamed [sqld64]

If this happens, check the loaded MySQL configuration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM