Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.2k views
in Technique[技术] by (71.8m points)

php - Laravel: multi-DB not respecting the HOST attribute

I'm reposting this question because the previous one was closed as being answered by a related post here but it wasn't.

That post is saying how to access the mysqls using raw commands. My question has to do with how LARAVEL handles it - because I use eloquent and laravel relationships to handle all the pivots, etc.


So I have a multi-DB setup which I thought was working (well it does, but the caveat is the title)

I'm currently using two databases, one for the actual app we're developing, and another DB specifically for user accounts.

Here's the snippet on the ENV side:

DB_CONNECTION=mysql
DB_HOST=APP_SERVER_IP
DB_PORT=APP_SERVER_PORT
DB_DATABASE=APP_SERVER_DB
DB_USERNAME=APP_SERVER_USER
DB_PASSWORD=APP_SERVER_PASS

DB_CONNECTION_SH=mysql
DB_HOST_SH=ACCOUNTS_SERVER_IP
DB_PORT_SH=ACCOUNTS_SERVER_PORT
DB_DATABASE_SH=ACCOUNTS_SERVER_DB
DB_USERNAME_SH=ACCOUNTS_SERVER_USER
DB_PASSWORD_SH=ACCOUNTS_SERVER_PASS

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...