Skip to content

[QUESTION] SQLSTATE[HY000] [2006] MySQL server has gone away #6176

@oknixus

Description

@oknixus

Execute the command and paste the result below.
php bin/hyperf.php migrate

/var/www/html/hyperf # php bin/hyperf.php migrate
[2023-09-26 11:05:07 @369.0]    TRACE   Context::Context(:53): alloc stack: size=2097152, ptr=0x7f57d34c71f0
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
[2023-09-26 11:05:10 @369.0]    TRACE   php_swoole_reactor_init(:236): init reactor
[2023-09-26 11:05:10 @369.0]    TRACE   Context::Context(:53): alloc stack: size=2097152, ptr=0x7f57d29ff490
[2023-09-26 11:05:10 @369.0]    TRACE   PHPCoroutine::main_func(:672): Create coro id: 1, origin cid: -1, coro total count: 1, heap size: 9754224
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::add(:107): add events[fd=6#0, type=5, events=512]
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130555
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130586
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130732
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130693
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130663
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130816
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130820
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130781
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130863
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130896
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130933
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.130982
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.131000
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.131036
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.131065
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::dispatch(:155): push and notify one: 1695697511.131087
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.131110
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::add(:144): id=1, exec_msec=60000, msec=60000, round=0, exist=1
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): pop 1 event: 1695697511.131090
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.131121
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   ThreadPool::create_thread(:254): aio_thread failed. ret=0, error=0
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.131399
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::remove(:177): id=1, exec_msec=60000, round=0, exist=0
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::add(:144): id=2, exec_msec=30000, msec=30000, round=0, exist=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::add(:107): add events[fd=5#0, type=6, events=1024]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:176): socket#5 blongs to cid#1 is waiting for WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=0, round=0
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::del(:128): remove event[reactor_id=0|fd=5]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:220): socket#5 blongs to cid#1 trigger WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::remove(:177): id=2, exec_msec=30000, round=0, exist=0
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::recv(:730): recv -1/32768 bytes, errno=11
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::add(:144): id=3, exec_msec=30005, msec=30000, round=1, exist=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::add(:107): add events[fd=8#0, type=6, events=1024]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:176): socket#8 blongs to cid#1 is waiting for WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=5, round=1
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::del(:128): remove event[reactor_id=0|fd=8]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:220): socket#8 blongs to cid#1 trigger WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::remove(:177): id=3, exec_msec=30005, round=1, exist=0
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::recv(:730): recv 77/32768 bytes, errno=0
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::send(:756): send 144/144 bytes, errno=0
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::recv(:730): recv -1/32768 bytes, errno=11
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::recv(:730): recv -1/32768 bytes, errno=11
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::dispatch(:155): push and notify one: 1695697511.143037
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): pop 1 event: 1695697511.143047
[WARNING] Database connection refreshing.
[2023-09-26 11:05:11 @369.0]    TRACE   ThreadPool::create_thread(:254): aio_thread failed. ret=0, error=22
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=11, round=2
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.143095
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::add(:144): id=4, exec_msec=30012, msec=30000, round=3, exist=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::add(:107): add events[fd=5#0, type=6, events=1024]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:176): socket#5 blongs to cid#1 is waiting for WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=12, round=3
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::del(:128): remove event[reactor_id=0|fd=5]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:220): socket#5 blongs to cid#1 trigger WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::remove(:177): id=4, exec_msec=30012, round=3, exist=0
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::recv(:730): recv -1/32768 bytes, errno=11
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::add(:144): id=5, exec_msec=30012, msec=30000, round=4, exist=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::add(:107): add events[fd=8#0, type=6, events=1024]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:176): socket#8 blongs to cid#1 is waiting for WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=12, round=4
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::del(:128): remove event[reactor_id=0|fd=8]
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::wait_event(:220): socket#8 blongs to cid#1 trigger WRITE event
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::remove(:177): id=5, exec_msec=30012, round=4, exist=0
[2023-09-26 11:05:11 @369.0]    TRACE   Socket::recv(:730): recv -1/32768 bytes, errno=11
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::dispatch(:155): push and notify one: 1695697511.143916
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): pop 1 event: 1695697511.143922
SQLSTATE[HY000] [2006] MySQL server has gone away
[2023-09-26 11:05:11 @369.0]    TRACE   ThreadPool::create_thread(:254): aio_thread failed. ret=0, error=22
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=12, round=5
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.144002
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::dispatch(:155): push and notify one: 1695697511.148261
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): pop 1 event: 1695697511.148269
[ERROR] PDOException: PDO::__construct(): Error while reading greeting packet. PID=369 in /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php:106
Stack trace:
#0 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php(106): PDO->__construct('mysql:host=mysq...', 'root', Object(SensitiveParameterValue), Array)
#1 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php(134): Hyperf\Database\Connectors\Connector->createPdoConnection('mysql:host=mysq...', 'root', 'root', Array)
#2 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php(57): Hyperf\Database\Connectors\Connector->tryAgainIfCausedByLostConnection(Object(PDOException), 'mysql:host=mysq...', 'root', 'root', Array)
#3 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/MySqlConnector.php(32): Hyperf\Database\Connectors\Connector->createConnection('mysql:host=mysq...', Array, Array)
#4 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/ConnectionFactory.php(196): Hyperf\Database\Connectors\MySqlConnector->connect(Array)
#5 [internal function]: Hyperf\Database\Connectors\ConnectionFactory->Hyperf\Database\Connectors\{closure}()
#6 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(602): call_user_func(Object(Closure))
#7 /var/www/html/hyperf/vendor/hyperf/db-connection/src/Connection.php(135): Hyperf\Database\Connection->getPdo()
#8 /var/www/html/hyperf/vendor/hyperf/db-connection/src/Connection.php(81): Hyperf\DbConnection\Connection->refresh(Object(Hyperf\Database\MySqlConnection))
#9 [internal function]: Hyperf\DbConnection\Connection->Hyperf\DbConnection\{closure}(Object(Hyperf\Database\MySqlConnection))
#10 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(471): call_user_func(Object(Closure), Object(Hyperf\Database\MySqlConnection))
#11 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(1115): Hyperf\Database\Connection->reconnect()
#12 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(1097): Hyperf\Database\Connection->tryAgainIfCausedByLostConnection(Object(Hyperf\Database\Exception\QueryException), 'select * from i...', Array, Object(Closure))
#13 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(1023): Hyperf\Database\Connection->handleQueryException(Object(Hyperf\Database\Exception\QueryException), 'select * from i...', Array, Object(Closure))
#14 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(254): Hyperf\Database\Connection->run('select * from i...', Array, Object(Closure))
#15 /var/www/html/hyperf/vendor/hyperf/database/src/Schema/MySqlBuilder.php(27): Hyperf\Database\Connection->select('select * from i...', Array)
#16 /var/www/html/hyperf/vendor/hyperf/database/src/Migrations/DatabaseMigrationRepository.php(156): Hyperf\Database\Schema\MySqlBuilder->hasTable('migrations')
#17 /var/www/html/hyperf/vendor/hyperf/database/src/Migrations/Migrator.php(262): Hyperf\Database\Migrations\DatabaseMigrationRepository->repositoryExists()
#18 /var/www/html/hyperf/vendor/hyperf/database/src/Commands/Migrations/MigrateCommand.php(79): Hyperf\Database\Migrations\Migrator->repositoryExists()
#19 /var/www/html/hyperf/vendor/hyperf/database/src/Commands/Migrations/MigrateCommand.php(40): Hyperf\Database\Commands\Migrations\MigrateCommand->prepareDatabase()
#20 /var/www/html/hyperf/vendor/hyperf/command/src/Command.php(428): Hyperf\Database\Commands\Migrations\MigrateCommand->handle()
#21 [internal function]: Hyperf\Command\Command->Hyperf\Command\{closure}()
#22 {main}

Next PDOException: SQLSTATE[HY000] [2006] MySQL server has gone away in /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php:106
Stack trace:
#0 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php(106): PDO->__construct('mysql:host=mysq...', 'root', Object(SensitiveParameterValue), Array)
#1 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php(134): Hyperf\Database\Connectors\Connector->createPdoConnection('mysql:host=mysq...', 'root', 'root', Array)
#2 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php(57): Hyperf\Database\Connectors\Connector->tryAgainIfCausedByLostConnection(Object(PDOException), 'mysql:host=mysq...', 'root', 'root', Array)
#3 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/MySqlConnector.php(32): Hyperf\Database\Connectors\Connector->createConnection('mysql:host=mysq...', Array, Array)
#4 /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/ConnectionFactory.php(196): Hyperf\Database\Connectors\MySqlConnector->connect(Array)
#5 [internal function]: Hyperf\Database\Connectors\ConnectionFactory->Hyperf\Database\Connectors\{closure}()
#6 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(602): call_user_func(Object(Closure))
#7 /var/www/html/hyperf/vendor/hyperf/db-connection/src/Connection.php(135): Hyperf\Database\Connection->getPdo()
#8 /var/www/html/hyperf/vendor/hyperf/db-connection/src/Connection.php(81): Hyperf\DbConnection\Connection->refresh(Object(Hyperf\Database\MySqlConnection))
#9 [internal function]: Hyperf\DbConnection\Connection->Hyperf\DbConnection\{closure}(Object(Hyperf\Database\MySqlConnection))
#10 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(471): call_user_func(Object(Closure), Object(Hyperf\Database\MySqlConnection))
#11 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(1115): Hyperf\Database\Connection->reconnect()
#12 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(1097): Hyperf\Database\Connection->tryAgainIfCausedByLostConnection(Object(Hyperf\Database\Exception\QueryException), 'select * from i...', Array, Object(Closure))
#13 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(1023): Hyperf\Database\Connection->handleQueryException(Object(Hyperf\Database\Exception\QueryException), 'select * from i...', Array, Object(Closure))
#14 /var/www/html/hyperf/vendor/hyperf/database/src/Connection.php(254): Hyperf\Database\Connection->run('select * from i...', Array, Object(Closure))
#15 /var/www/html/hyperf/vendor/hyperf/database/src/Schema/MySqlBuilder.php(27): Hyperf\Database\Connection->select('select * from i...', Array)
#16 /var/www/html/hyperf/vendor/hyperf/database/src/Migrations/DatabaseMigrationRepository.php(156): Hyperf\Database\Schema\MySqlBuilder->hasTable('migrations')
#17 /var/www/html/hyperf/vendor/hyperf/database/src/Migrations/Migrator.php(262): Hyperf\Database\Migrations\DatabaseMigrationRepository->repositoryExists()
#18 /var/www/html/hyperf/vendor/hyperf/database/src/Commands/Migrations/MigrateCommand.php(79): Hyperf\Database\Migrations\Migrator->repositoryExists()
#19 /var/www/html/hyperf/vendor/hyperf/database/src/Commands/Migrations/MigrateCommand.php(40): Hyperf\Database\Commands\Migrations\MigrateCommand->prepareDatabase()
#20 /var/www/html/hyperf/vendor/hyperf/command/src/Command.php(428): Hyperf\Database\Commands\Migrations\MigrateCommand->handle()
#21 [internal function]: Hyperf\Command\Command->Hyperf\Command\{closure}()
#22 {main}
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   ThreadPool::create_thread(:254): aio_thread failed. ret=0, error=22
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=17, round=6
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.148359
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::dispatch(:155): push and notify one: 1695697511.148445
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): pop 1 event: 1695697511.148455
[DEBUG] Event Hyperf\Command\Event\FailToHandle handled by Hyperf\Command\Listener\FailToHandleListener listener.
[2023-09-26 11:05:11 @369.0]    TRACE   ThreadPool::create_thread(:254): aio_thread failed. ret=0, error=22
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.148491
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=17, round=7
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   Channel::close(:159): channel closed
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::dispatch(:155): push and notify one: 1695697511.165644
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): pop 1 event: 1695697511.165656
[DEBUG] Event Hyperf\Command\Event\AfterExecute handled by App\Listener\ResumeExitCoordinatorListener listener.
[2023-09-26 11:05:11 @369.0]    TRACE   ThreadPool::create_thread(:254): aio_thread failed. ret=0, error=22
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_yield(:567): from cid=1 to cid=-1
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=34, round=8
[2023-09-26 11:05:11 @369.0]    DEBUG   ThreadPool::create_thread(:241): no event: 1695697511.165699
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::on_resume(:585): from cid=-1 to cid=1
[2023-09-26 11:05:11 @369.0]    TRACE   Channel::push(:144): push data to channel, count=1
[2023-09-26 11:05:11 @369.0]    TRACE   PHPCoroutine::destroy_context(:654): coro close cid=1 and resume to -1, 0 remained. usage size: 10890048. malloc size: 12582912
[2023-09-26 11:05:11 @369.0]    TRACE   Context::~Context(:90): free stack: ptr=0x7f57d29ff490
[2023-09-26 11:05:11 @369.0]    TRACE   Timer::select(:196): timer msec=34, round=9
[2023-09-26 11:05:11 @369.0]    TRACE   ReactorEpoll::del(:128): remove event[reactor_id=0|fd=6]

Command: uname -a && php -v && composer info | grep hyperf && php --ri swoole

/var/www/html/hyperf # uname -a && php -v && php ../composer.phar info | grep hyperf && php --ri swoole
Linux 86a3a14acea1 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 Linux
PHP 8.2.9 (cli) (built: Aug 17 2023 23:45:14) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.2.9, Copyright (c) Zend Technologies
hyperf/cache                       v3.0.37 A cache component for hyperf.
hyperf/code-parser                 v3.0.37 A code parser component for Hyperf.
hyperf/codec                       v3.0.37 A codec component for Hyperf.
hyperf/collection                  v3.0.37 Hyperf Collection package which come from illuminate/collections
hyperf/command                     v3.0.37 Command for hyperf
hyperf/conditionable               v3.0.37 Hyperf Macroable package which come from illuminate/conditionable
hyperf/config                      v3.0.37 An independent component that provides configuration container.
hyperf/context                     v3.0.37 A coroutine/application context library.
hyperf/contract                    v3.0.37 The contracts of Hyperf.
hyperf/coordinator                 v3.0.37 Hyperf Coordinator
hyperf/coroutine                   v3.0.37 Hyperf Coroutine
hyperf/database                    v3.0.37 A flexible database library.
hyperf/db-connection               v3.0.37 A hyperf db connection handler for hyperf/database.
hyperf/devtool                     v3.0.37 A Devtool for Hyperf.
hyperf/di                          v3.0.37 A DI for Hyperf.
hyperf/dispatcher                  v3.0.37 A HTTP Server for Hyperf.
hyperf/engine                      v2.10.0 Coroutine engine provided by swoole.
hyperf/engine-contract             v1.9.0  Contract for Coroutine Engine
hyperf/event                       v3.0.37 an event manager that implements PSR-14.
hyperf/exception-handler           v3.0.37 Exception handler for hyperf
hyperf/framework                   v3.0.37 A coroutine framework that focuses on hyperspeed and flexible, specifically use for build...
hyperf/guzzle                      v3.0.37 Swoole coroutine handler for guzzle
hyperf/http-message                v3.0.37 microservice framework base on swoole
hyperf/http-server                 v3.0.37 A HTTP Server for Hyperf.
hyperf/logger                      v3.0.37 A logger component for hyperf.
hyperf/macroable                   v3.0.37 Hyperf Macroable package which come from illuminate/macroable
hyperf/memory                      v3.0.37 An independent component that use to operate and manage memory.
hyperf/model-listener              v3.0.37 A model listener for Hyperf.
hyperf/pipeline                    v3.0.37 Hyperf Macroable package which come from illuminate/pipeline
hyperf/pool                        v3.0.37 An independent universal connection pool component.
hyperf/process                     v3.0.37 A process component for hyperf.
hyperf/redis                       v3.0.37 A redis component for hyperf.
hyperf/serializer                  v3.0.37 A serializer component for Hyperf.
hyperf/server                      v3.0.37 A base server library for Hyperf.
hyperf/stringable                  v3.0.37 Hyperf Stringable package which come from illuminate/support
hyperf/support                     v3.0.37 A support component for Hyperf.
hyperf/tappable                    v3.0.37 Hyperf Macroable package which come from illuminate/tappable
hyperf/testing                     v3.0.37 Testing for hyperf
hyperf/utils                       v3.0.37 A tools package that could help developer solved the problem quickly.
[2023-09-26 11:04:07 @368.0]    TRACE   Context::Context(:53): alloc stack: size=2097152, ptr=0x7f5e7ecb91e0

swoole

Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 5.1.0-dev
Built => Aug 28 2023 14:12:48
coroutine => enabled with boost asm context
debug => enabled
trace_log => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.0.10 1 Aug 2023
dtls => enabled
http2 => enabled
json => enabled
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

Description:

执行数据库迁移时,报错:

SQLSTATE[HY000] [2006] MySQL server has gone away
// 此处省略数行,省略的内容,在上面已有粘贴
[ERROR] PDOException: PDO::__construct(): Error while reading greeting packet. PID=369 in /var/www/html/hyperf/vendor/hyperf/database/src/Connectors/Connector.php:106

Steps To Reproduce:

git clone https://github.com/oknixus/hyperf-issue.git

cd hyperf-issue
docker compose -f hyperf.yml up -d
docker exec -it mysql mysql -uroot -proot 
create database hyperf;
quit
docker exec -it hyperf sh
php bin/hyperf.php migrate

希望可以解决这个问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions