laravel - 我需要帮助在 laravel 中为 digitalocean 管理的数据库建立连接
问题描述
我创建了一个 mysql 集群,但在建立数据库和我的项目之间的连接时遇到了问题。
解决方案
在 DigitalOcen 中创建数据库和用户,然后运行以下命令:
GRANT ALL ON DB_NAME TO 'USER_NAME'@'%' WITH GRANT OPTION; ALTER USER 'USER_NAME' IDENTIFIED WITH mysql_native_password BY 'GIVE_THE_PASSWORD';
Laravel 连接:
DB_CONNECTION=mysql
DB_HOST=As given on DO managed DB
DB_PORT=As given on DO managed DB
DB_DATABASE=give the name of the database that you created within DO and want to use here
DB_USERNAME=give the name of the user that you created within DO and want to use here
DB_PASSWORD=give the pass of the database that has been created automatically while create DB
推荐阅读
- angular - 如何构建 Spring Boot 微服务
- c - 基于 LinkedList 的队列,创建新队列时不能返回空指针
- influxdb - 这个 influxdb 删除有什么问题?
- discord.py - discord py - 保存用户发布的图像并删除旧图像
- apache - 使用多个查询字符串重写规则
- r - 根据方程获取图
- c# - 如何获取目录中多个文件的 RSA 加密进度
- reactjs - T 的 Typescript 映射类型键,其中值是 V 类型
- javascript - 预期 T,在自定义 Object-Type 的 Vue-Prop 中得到对象
- flutter - 如何使用 cached_network_image 预加载图像?