我已經創建了名為My DB用戶名的MySQL數據庫,密碼是但是當我運行時,下面顯示錯誤消息。resume_managerrootpasswordphp artisan migrate Illuminate\Database\QueryException : SQLSTATE[HY000] [1049] Unknown database 'resume_manager' (SQL: select * from information_schema.tables where table_schema = resume_manager and table_name = migrations) at /home/geralt/Music/resume-manager/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) { > 664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668| Exception trace: 1 PDOException::("SQLSTATE[HY000] [1049] Unknown database 'resume_manager'") /home/geralt/Music/resume-manager/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68 2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=resume_manager", "root", "password", []) /home/geralt/Music/resume-manager/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68 Please use the argument -v to see more details.我在Xampp上運行MySQL。我已經檢查了我的.cnf文件端口設置為默認值,我不知道發生了什么。順便說一句,我正在使用.我還運行了所有關于3306Linux Mintcache php artisan cache:clear php artisan route:cache php artisan config:clear php artisan view:clear這是我的文件設置:.envAPP_NAME=LaravelAPP_ENV=localAPP_KEY=APP_DEBUG=trueAPP_URL=http://localhostLOG_CHANNEL=stackDB_CONNECTION=mysqlDB_HOST=127.0.0.1DB_PORT=3306DB_DATABASE=resume_managerDB_USERNAME=rootDB_PASSWORD=passwordBROADCAST_DRIVER=logCACHE_DRIVER=fileSESSION_DRIVER=fileSESSION_LIFETIME=120QUEUE_DRIVER=sync
4 回答

互換的青春
TA貢獻1797條經驗 獲得超6個贊
從錯誤中可以確定您的端口,用戶名和密碼都沒有問題,它們都是正確的...所以只是仔細檢查是否存在;resume_manager
簡單地轉到您的mysql控制臺并創建一個空數據庫
mysql> CREATE DATABASE resume_manager;
或
你也使用phpmyadmin做同樣的事情...
如果數據庫已經存在,它將給出錯誤,否則將創建新的所需數據庫...(您的舊數據庫名稱中可能存在一些拼寫錯誤問題)

慕俠2389804
TA貢獻1719條經驗 獲得超6個贊
每當我們更改 和 in 文件時,我們都需要清除緩存:DB_DATABASE
DB_USERNAME
DB_PASSWORD
.env
php artisan config:cache
運行遷移工匠命令后:php artisan migrate
- 4 回答
- 0 關注
- 151 瀏覽
添加回答
舉報
0/150
提交
取消