我正在嘗試使用 doctrine 在我的 mysql 中創建一個表。(我正在使用法語視頻學習 symfony:https ://www.youtube.com/watch?v= UTusmVpwJXo ,似乎該視頻是基于以前版本的 synfony 但是嘿,應該差不多吧) .所以我運行的命令是:php bin/console doctrine:database:create不幸的是我有這些結果:doctrine.yamldoctrine: dbal: default_connection: default driver: 'pdo_mysql' url: '%env(resolve:DATABASE_URL)%' server_version: '7.4.4' orm: auto_generate_proxy_classes: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true mappings: App: is_bundle: false type: annotation dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App然后是我的.env# In all environments, the following files are loaded if they exist,# the latter taking precedence over the former:## * .env contains default values for the environment variables needed by the app# * .env.local uncommitted file with local overrides# * .env.$APP_ENV committed environment-specific defaults# * .env.$APP_ENV.local uncommitted environment-specific overrides## Real environment variables win over .env files.## DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.## Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration###> symfony/framework-bundle ###APP_ENV=devAPP_SECRET=b3b1c82ba50949ebe4f89ac492c6c7f6#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16#TRUSTED_HOSTS='^(localhost|example\.com)$'###< symfony/framework-bundle ###我沒有設置任何密碼,我的 phpmyadmin 在以下位置正確運行http://127.0.0.1:8080/phpmyadmin/我的 mysql conf 看起來像這樣:也許它改變了什么(但我不這么認為),我的主頁正在運行http://127.0.0.1:8000/blog并且運行良好。我用啟動服務器symfony server:start -d。你們知道我在這里做錯了什么嗎?感謝您以后的幫助!在這個困難時期保持堅強并學習更多!
1 回答

慕村225694
TA貢獻1880條經驗 獲得超4個贊
我終于在這里找到了我的解決方案 -> Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server
這是 sql 作為安全進程的默認行為。
我按照答案中描述的確切步驟進行操作并且有效。
- 1 回答
- 0 關注
- 126 瀏覽
添加回答
舉報
0/150
提交
取消