我需要帮助以在Laravel中为Digitalocean托管数据库建立连接

时间:2019-10-23 09:19:00

标签: laravel

我创建了一个mysql集群,但在建立数据库与项目之间的连接时遇到了问题。

1 个答案:

答案 0 :(得分:0)

在DigitalOcen中创建数据库和用户 然后运行以下命令:

使用GRANT OPTION将所有DB_NAME上的内容全部授予“ USER_NAME” @'%'; ALTER USER'USER_NAME'用'GIVE_THE_PASSWORD'标识为mysql_native_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