Access denied to database while calling docker from command line - php

I took responsibility for a hughe project, a part of the project contains cronjobs to crawl data from a certain provider.
The project is written in Yii2 and it runs in Lando enviroment with docker desktop, on a windows10 machine with wsl2.
While working with the database container in phpmyadmin or in the browser everything connects nicely and runs fine. But if I try to call the cron from my windows or wsl console, I'm not able to connect to the database. (SQLSTATE[HY000] [1045] Access denied for user xxx#localhost, thrown by DB connector). The credentials are definitively valid, I'm using them all the time. The appserver container can communicate with the database.
I guess it has something to do with permissions windows host -> docker but I can't figure out where I have to change this this in docker or in lando (I'm not really experienced in docker unfortunately).
Any help or trick is welcome!

Related

Why does Symfony ask a valid token when I start a local server?

I have a symfony 5.1 application under development on my laptop.
This command failed:
symfony console server:start
Your token has been revoked, please login again
Then, the prompt purposes me to login, but I cannot always login, because I'm behind a firewall that rejects external access for some security reasons.
I tried :
to uninstall the local certificate authority,
to launch server without TLS,
to launch server with the command symfony serve -d (I got the same error message)
to launch application with different version of PHP (by using .php-version file)
It's perhaps because I tested a demo symfony cloud which is expired. So, I tried to remove all elements about cloud.
Without success...
As soon as I am offline, the server can be started.
As soon as I'm connected on other network I can login, but I want to launch this local server when I'm on our enterprise network. (And I'm tired to disconnect from network)
I had a problem like this. It helped me - symfony account:logout
Here I found the answer - https://github.com/symfony/cli/issues/281
edit by Alexandre: I only had to logout from cloud. Because of the firewall rules, symfony detected that Internet was available and try to get a new token, but fails because of firewall rules.
Now I only have to disconnect from cloud when I am connect on enterprise network:
symfony account:logout
If I got this right, you want to start your server only locally right?
symfony serve -d
The -d flag starts the server in the background. You might want to install the certificate in order to serve https:// with the following command: symfony server:ca:install. Both commands are issued inside the root directory of your project.
Once you're done, go into the root directory where you started your server and type in this command to stop the server: symfony server:stop
This should give you a local web server with your symfony project.
FYI: In case you have installed several PHP-Versions you might need to pick a specific one by saving a .php-version file to your root directory:
For any 7.x version:
echo 7 > .php-version
For 7.2 version:
echo 7.2 > .php-version

How to run Larvel's php artisan commands on Google App Engine

I have my staging site for a Laravel app hosted on a Google App Engine instance. The production site is hosted on Compute Engine and isn't a managed server so I am not as familiar with the set up on GAE - I wanted to try it out in order to eventually move our production site onto a managed server.
I'm having an issue where I can't figure out how to run php artisan commands on staging! I managed to use the google sdk and the cloud sql proxy in order to access the staging database, and I assumed I could use some kind of gcloud command to run the artisan command, like something like gcloud --compute="php artisan migrate" but I can't figure out the best way to do it.
I also have tried using GCP's in-app terminal to ssh into the instance, but it seems like I have no access to the actual project files within that ssh so I can't run the artisan commands.
Does anyone know best practices for running a migration on this type of server?
I'm also using an app.yaml file to build the instance, so I was thinking maybe I should figure out how to put the command there, but I'm not sure if that's the right move as the only information I have in that file is the env info and server resources info.
Please help! thank you :)
One way of running migrations to your laravel project that is hosted on Google App Engine would be to connect your local environment project to the project's Google Cloud SQL. From there you can just run the migrations from your local environment.
Like #TMK said, connect through the SQL proxy. It's simple.
Create an SQL instance using the instructions found here
Follow the instructions here
with that done, you can run your migration command right from your bash terminal

Laravel Project setup

Hi There I have a query on how to setup a laravel project in a team that is connected to LAN, I am using xampp and i have successfully share my htdocs folder, phpmyadmin, so others can access though "filezilla" now I want to know how to share command prompt(cmd as windows users) because laravel project are more based on command line so i need to share my cmd or xampp shell
eg:- laravel command accessed through cmd :-
"php artisan make:migration create_users_table"
so server can execute the command successfully but what about other users who are connected to me through LAN
They just need to connect your computer through the command line using the IP, Port , username & password. Other thing is you need to set correct permission setting for the project folder.

Capistrano SSH Connection

I am trying to use capistrano to deploy my php application to a server. For versionising the code, I am using GIT in combination with Bitbucket.
For CI process, I am using jenkins on a virtual machine with ip 192.168.65.68. When I develop on another virtual machine, I push changes to this machine and the CI process starts - this is working. Now I wanted to go one step ahead and use Capistrano to deploy the app (first to a new folder on the same CI machine). Within deploy.rb file of my project, I tried to connect with ssh to the project by using the same options I provide within jenkins to connect (192.168.65.68 = localhost):
set :repo_url, 'ssh://git#192.168.65.68:7999/nav/myrepo.git'
set :ssh_user, 'jenkins'
When I run "cap production deploy --trace", I get a connection error that the connection got blocked.
So my question is: Is my attempt to connect from the CI machine to the Bitbucket repo completely wrong? How do you connect via ssh to your repo and fetch the source code when using capistrano?

Set up MySQL Database Connection With Netbeans on Ubuntu

Trying to integrate netbeans with mysql database management into the IDE as explained here.
I am running Ubuntu 11.1 on my local machine with phpMyAdmin.
I have set the usr name and password and the correct port number, but I can't seem to set the path to the phpmyadmin in the admin tab.
I have tried /usr/share/phpmyadmin/index.php as well as /etc/phpmyadmin .. both time I get a permission denied error and I am not entirely sure what file netbeans actually wants to work with.
Any Help would be truly appreciated.. Thanks in advance
You cant run phpmyadmin as a command line tool so the URI you need would be to the installation on the local webserver like http://localhost/phpmyadmin/index.php ... whatever URL you use to access it in a browser on your machine.
That said I dont know why you would use PHP My Admin when you could use MySQL Workbench or one of the other GNOME or KDE admin apps. They are all pretty much superior :-)

Categories