Laravel CI/CD in Gitlab, Docker set my IP MySQL

Laravel CI/CD in Gitlab, Docker set my IP MySQL



I followed this Gitlab tutorial to test and deploy Laravel applications with GitLab CI/CD and Envoy.



All works well, but when I run a pipeline it shows this error:



PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'user'@'172.17.0.4' (using password: YES)")



My IP server is 172.0.0.1 but the pipeline set the IP by 172.17.0.4.



How can I set the IP to make work it?





Show me your connect DB in .env file....
– Truong Dang
May 26 at 2:48





The .env file has the correct password and variables. ` DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=blog DB_USERNAME=user DB_PASSWORD=mypass`
– albertcito
May 26 at 2:59






Your mysql is running inside a docker container right ? If in that case, i think that connect DB_HOST=127.0.0.1 this way is problem...
– Truong Dang
May 26 at 3:02



DB_HOST=127.0.0.1





Please show your gitlab-ci.yml file
– Truong Dang
May 26 at 3:05


gitlab-ci.yml





gitlab-ci.yml: variables: MYSQL_DATABASE: blog MYSQL_ROOT_PASSWORD: V4ld1v1@Ch1l3-2018 DB_HOST: mysql DB_USERNAME: laravel The file is: gitlab.com/albertcito/blog/blob/master/.gitlab-ci.yml
– albertcito
May 26 at 3:10


gitlab-ci.yml




1 Answer
1



Finally, it works. I added only this values to the yml file:


yml


variables:
MYSQL_DATABASE: mydatabase
MYSQL_ROOT_PASSWORD: 123456



Obviously the same values to the .env file.


.env



(I also uninstalled and re-installed MySQL, but I don't know if that helped to solve it)



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

Node.js puppeteer - Use values from array in a loop to cycle through pages