背景
我有一个基本的Laravel应用程序,运行正常。我在上面运行了php artisan make:auth
,进行了迁移,注册了新用户并能够登录和查看home.blade.php。我正在使用代客服务服务该网站,并将其停放在目录中。
我不使用Homestead,而只是使用本地计算机。
导致问题的原因
我运行了brew update / brew upgrade
,现在根本无法登录到该应用程序。
预期结果
登录到应用程序并查看home.blade.php
引发错误
PDOException (2006)
SQLSTATE[HY000] [2006] MySQL server has gone away
在浏览器中显示。
PDOException(code: 0): PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109
显示在Laravel日志中。
我怀疑与MySQL的用户权限有关,尽管我在这里处于停滞状态,所以我认为我应该把它扔给Obi-Wan的计算机世界。
有效的方法
我仍然可以在浏览器中查看welcome.blade.php,并且对服务器执行ping操作会返回响应,这样就可以了。
我可以通过终端以root身份登录MySQL没问题。
mysql -u root -p
mysql> SELECT user, host FROM mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| jason | % |
| jason | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
6 rows in set (0.00 sec)
我的数据库存在
mysql> show tables;
+-----------------------+
| Tables_in_digitalchef |
+-----------------------+
| migrations |
| model_has_permissions |
| model_has_roles |
| orders |
| password_resets |
| permissions |
| role_has_permissions |
| roles |
| users |
+-----------------------+
9 rows in set (0.00 sec)
mysql>
我的设置
PHP版本
jason@Jasons-MacBook-Air:~/Desktop/websites$ php -v
PHP 7.2.8 (cli) (built: Jul 19 2018 12:15:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.8, Copyright (c) 1999-2018, by Zend Technologies
Nginx版本
jason@Jasons-MacBook-Air:~/Desktop/websites$ nginx -v
nginx version: nginx/1.15.3
MySQL版本
jason@Jasons-MacBook-Air:~$ mysql --version
mysql Ver 8.0.12 for osx10.13 on x86_64 (Homebrew)
代客版本
Laravel Valet 2.0.9
$ PATH
jason@Jasons-MacBook-Air:~$ echo $PATH
/usr/local/opt/mysql@8.0/bin:/usr/local/sbin:/Users/jason/.composer/vendor/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin/python3:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
编辑-更新了此内容,仍然没有运气 我的 /etc/my.cnf的内容:
[mysqld]
max_allowed_packet = 500M
wait_timeout = 58800
ssl-ca=/etc/mysql-ssl/ca-cert.pem
ssl-cert=/etc/mysql-ssl/server-cert.pem
ssl-key=/etc/mysql-ssl/server-key.pem
我的 .env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:/rKbcwAqCwbNt9XNBZq1jzvRzi7K4Jdch3k5/OtUgis=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=digitalchef
DB_USERNAME=root
DB_PASSWORD=root
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
我的 database.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];
日志中的最新条目
[2018-09-10 18:15:26] local.ERROR: SQLSTATE[HY000] [2006] MySQL server has gone away {"exception":"[object] (PDOException(code: 2006): SQLSTATE[HY000] [2006] MySQL server has gone away at /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68, PDOException(code: 0): PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109 at /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68)
[stacktrace]
#0 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(68): PDO->__construct('mysql:host=127....', 'root', 'root', Array)
#1 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(98): Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=127....', 'root', 'root', Array)
#2 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(48): Illuminate\\Database\\Connectors\\Connector->tryAgainIfCausedByLostConnection(Object(PDOException), 'mysql:host=127....', 'root', 'root', Array)
#3 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection('mysql:host=127....', Array, Array)
#4 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(182): Illuminate\\Database\\Connectors\\MySqlConnector->connect(Array)
#5 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()
#6 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connection.php(915): call_user_func(Object(Closure))
#7 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(248): Illuminate\\Database\\Connection->getPdo()
#8 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(234): Illuminate\\Database\\DatabaseManager->refreshPdoConnections('mysql')
#9 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(168): Illuminate\\Database\\DatabaseManager->reconnect('mysql')
#10 [internal function]: Illuminate\\Database\\DatabaseManager->Illuminate\\Database\\{closure}(Object(Illuminate\\Database\\MySqlConnection))
#11 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connection.php(753): call_user_func(Object(Closure), Object(Illuminate\\Database\\MySqlConnection))
#12 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connection.php(735): Illuminate\\Database\\Connection->reconnect()
#13 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connection.php(717): Illuminate\\Database\\Connection->tryAgainIfCausedByLostConnection(Object(Illuminate\\Database\\QueryException), 'select * from `...', Array, Object(Closure))
#14 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connection.php(627): Illuminate\\Database\\Connection->handleQueryException(Object(Illuminate\\Database\\QueryException), 'select * from `...', Array, Object(Closure))
#15 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#16 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1963): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#17 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1951): Illuminate\\Database\\Query\\Builder->runSelect()
#18 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2435): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#19 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1952): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#20 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(481): Illuminate\\Database\\Query\\Builder->get(Array)
#21 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(465): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#22 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(77): Illuminate\\Database\\Eloquent\\Builder->get(Array)
#23 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php(128): Illuminate\\Database\\Eloquent\\Builder->first()
#24 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php(352): Illuminate\\Auth\\EloquentUserProvider->retrieveByCredentials(Array)
#25 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php(79): Illuminate\\Auth\\SessionGuard->attempt(Array, false)
#26 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php(44): App\\Http\\Controllers\\Auth\\LoginController->attemptLogin(Object(Illuminate\\Http\\Request))
#27 [internal function]: App\\Http\\Controllers\\Auth\\LoginController->login(Object(Illuminate\\Http\\Request))
#28 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#29 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('login', Array)
#30 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\Auth\\LoginController), 'login')
#31 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#32 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Router.php(665): Illuminate\\Routing\\Route->run()
#33 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#34 /Users/jason/Desktop/websites/restaurant/digitalchef/app/Http/Middleware/RedirectIfAuthenticated.php(24): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): App\\Http\\Middleware\\RedirectIfAuthenticated->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#38 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#39 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#40 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(68): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#41 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#44 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#47 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#50 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#52 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#53 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#56 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Router.php(667): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#57 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Router.php(642): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#58 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Router.php(608): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#59 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Router.php(597): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#60 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#61 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#62 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#63 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#64 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#65 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#66 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#67 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#68 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#69 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#70 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#71 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#72 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#73 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#74 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#75 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#76 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#77 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#78 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#79 /Users/jason/Desktop/websites/restaurant/digitalchef/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#80 /Users/jason/Desktop/websites/restaurant/digitalchef/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#81 /Users/jason/.composer/vendor/laravel/valet/server.php(147): require('/Users/jason/De...')
#82 {main}
"}
我一直在尝试什么:
mysql> GRANT ALL PRIVILEGES ON digitalchef.* TO 'root'@'localhost';
但没有骰子。 我不想不必回滚到7.2.7,但是如果这是唯一的选择,那么我想我正处于困境和困境之间,别无选择。
任何帮助都会很棒。如果您需要有关任何内容的更多信息,请问一下,我会回答。提前非常感谢您!
答案 0 :(得分:1)
这对我有用。我使用以下命令使用新的身份验证插件更新密码。您现在可以使用MySQL 8。玩得开心。
ALTER USER `username`@`localhost` IDENTIFIED WITH caching_sha2_password BY 'password';
如果上述方法不起作用,请改用此方法。
ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
答案 1 :(得分:0)
安装mysql和卸载mysql / maria db无法解决该问题。发生这种情况可能有多种原因。
这通常表示MySQL服务器连接问题或超时。
您可以通过调整my.cnf
和wait_timeout
来调整max_allowed_packet
中的设置。
尝试将其设置为更高的值,继续调整设置,直到正确为止。进行这些更改后,请确保重新启动mysql。
wait_timeout = 28800
max_allowed_packet = 8M
以下是您需要更改的很好的说明
https://www.digitalocean.com/community/questions/mysql-server-has-gone-away
答案 2 :(得分:0)
解决了这个问题! 哇!再次感谢大家提供的所有建议,我非常感谢您的帮助。
我如何解决:
深入研究这个问题,我发现我安装了2个MySQL版本-5.7和8.0。
brew uninstall mysql@5.7
brew link mysql@8.0
sudo nano ~/.bash_profile
export PATH="/usr/local/opt/mysql@8.0/bin:$PATH"
mysql -u root -p
mysql> USE digitalchef;
mysql> TRUNCATE TABLE users;
我不知道事后是否完成了任何事情,但是我确保在事后运行php artisan config:cache
,只是为了很好。
希望这可以帮助正在为此苦苦挣扎的人!再次感谢大家的支持,@ poohbear的回答值得为之疯狂。
答案 3 :(得分:0)
如果msyql客户端正常,则只有php7脚本有问题, 您可以检查php.ini(mysqlnd.net_read_timeout)
答案 4 :(得分:-1)
您可能已经重新启动了mysql,但如果没有,请尝试执行
万一它不起作用,请尝试将其卸载:
brew uninstall mysql
并安装mariadb,它将类似于mysql:
brew install mariadb
然后,您仍然可以mysql -uroot
来管理数据库