I am trying to connect a Laravel to Google mysql instance locally.
.env file
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:GptV9AIxUX7TuPkKxbLs54DLjivt2wCmuG37qsnqxJU=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=**********
DB_USERNAME=**********
DB_PASSWORD=**********
DB_SOCKET=/cloudsql/[INSTANCE NAME]
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
I am using this cloud_sql_proxy command:
~/Downloads/cloud_sql_proxy -instances=/cloudsql/[INSTANCE_ID]=tcp:3306
and it working properly,
2018/07/18 13:46:29 Listening on 127.0.0.1:3306 for /cloudsql/[INSTANCE ID]
2018/07/18 13:46:29 Ready for new connections
I also enabled enabled Google Cloud SQL and Cloud SQL Admin API for my project.
The error I receive is:
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `campaigns`)
Below are my observation in struggle to find a solution.
In Stackdriver logging error that I see is
severity: "ERROR"
textPayload: "2018-07-18T05:57:08.204597Z 859643 [Note] Aborted connection 859643 to db: '[DB_NAME]' user: '[DB_USER]' host: 'cloudsqlproxy~173.194.90.33' (Got an error reading communication packets)"
When I check ~/Downloads/cloud_sql_proxy info:
2018/07/18 14:10:50 Using gcloud's active project: [PROJECT ID]
2018/07/18 14:10:55 must set -dir: using a unix socket for [INSTANCE NAME]
I am actually not able to relate if this is related to error.
I have tried connecting cloud sql using service account, its connects properly but still not able to resolve this issue.
Thanks in advance.
There are two ways to connect to Cloud SQL: via TCP or via a Unix Socket.
If you are using a Unix Socket, you need to specify -dir /cloudsql (or similar) as a directory to create your socket in. Full command looks something like this:
./cloud_sql_proxy -dir=/cloudsql -instances=myProject:uscentral1:myInstance
You would then use DB_SOCKET=/cloudsql/myProject:uscentral1:myInstance to connect. (You don't need a host or port - you're connecting via the unix socket)
If you are using TCP, you apply the port you want to listen to your instance name. So the command looks like this:
./cloud_sql_proxy -instances=myProject:us-central1:myInstance=tcp:3306
In this case, you use DB_HOST=127.0.0.1 and DB_PORT=3306 (but not DB_SOCKET).
Related
So I'm still in the process of updating a Drupal 7 site to 8 using drush and ddev.
After running the import, I get an error with upgrade_d7_file.
I've tried to install a certificate using this article:
https://www.ddev.com/ddev-local/ddev-local-trusted-https-certificates/
However still get the error, any ideas?
ddev exec drush migrate-import --all
ddev exec drush mmsg upgrade_d7_file
cURL error 60: SSL: no alternative certificate subject name matches target host name
'drupal7migration2.ddev.site'
(see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
(https://drupal7migration2.ddev.site//sites/default/files/Virtual%20Challenges%20%28Results%20and%2
0PBs%29%2020200709.xlsx)
When you want one DDEV-Local project to talk to another using https, curl on the client side has to trust the server side that you're talking to. There are two ways to do this:
(built-in, no changes needed): Use ddev-<projectname>-web (the container name) as the target hostname in the URL. For example in your case, use curl https://ddev-drupal7migration2-web. This hostname is already trusted among various ddev projects.
(requires docker-compose.*.yaml): If you want to use the real full FQDN of the target project (https://drupal7migration2.ddev.site in your case) then you'll need to add that as an external_link in the client project's .ddev. So add a file named .ddev/docker-compose.external_links.yaml in the client side (migration1?) project, with these contents:
version: '3.6'
services:
web:
external_links:
- "ddev-router:drupal7migration2.ddev.site"
That will tell Docker to route requests to "drupal7migration2.ddev.site" to the ddev-router, and your container and curl trust it (it has that name in its cert list).
i have react with asp.net core website . it worked fine on localhost but when published on iis remote server the timeout error occurs.
the front-end (react client) and back-end(server) asp.netcore webapi work independently.
before uploading i changed the following in program.cs in webapi.
usUrl("https://localhost:4000")
to useUrl("https://www.virtualcollege.pk:4000")
i also changed the front-end baseurl similarly.
moreover, the connectionstrings in appsettings.json is correct for both databases.
i added migration and updated the databases successfully.
the website is live but timeout error occur :
virtualcollege.pk
i also tried the url with "https://myip-address:4000"
thanks in advance for help.
if i remove port number from url and publish on local folder than upload to remote server . the webapi.exe on local machine runs as follows:
You have to open incoming request for 4000 port. Try some methods below.
Windows Server
Please check this link or this one
Ubuntu/Debian
sudo ufw allow 4000/tcp
sudo ufw status // check status
CentOS
First, you should disable selinux, edit file /etc/sysconfig/selinux so it looks like this:
SELINUX=disabled
SELINUXTYPE=targeted
Save file and restart system.
Then you can add the new rule to iptables:
iptables -A INPUT -m state --state NEW -p tcp --dport 4000 -j ACCEPT
and restart iptables with /etc/init.d/iptables restart
I'm trying to setup an instance on my phoenix app. I'm actually able to generate the app but I'm getting an error when trying to connect to the DB:
ERROR:
21:11:31.017 [error] Postgrex.Protocol (#PID<0.2223.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (/tmp/cloudsql/statcasters:us-central1:statcastersdb): no such file or directory - :enoent
I'm not sure what is wrong? The file seems to exist but it seems to say it doesn't:
prod.secret.exs:
config :statcasters, Statcasters.Repo,
username: "postgres",
password: System.get_env("DATABASE_PASSWORD"),
database: "statcasters_prod",
socket: "/tmp/cloudsql/statcasters:us-central1:statcastersdb",
pool_size: 20
I'm not sure what more information I can give? Does anybody know what I could be missing here?
There are 2 flavors of App Engine so please see the instructions linked here: https://cloud.google.com/sql/docs/postgres/connect-app-engine
The socket name appears to include a redundant "/tmp" prefix and should start with "/cloudsql/..." for App Engine standard.
I have installed homestead on my machine and cloned a project from a remote repository, now I am trying to create a DB for my project.
This is how my .env file looks like:
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:e7K7SUDgogNqTtP9TO1CfpbXFAC6FmLLSJ1l6K8pbWs=
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
I have tried to connect to DB using sequel pro standard option:
Host: localhost
Password: secret
But I get:
Unable to connect to host 127.0.0.1, or the request timed out.
Be sure that the address is correct and that you have the necessary
privileges, or try increasing the connection timeout (currently 10
seconds).
MySQL said: Can't connect to MySQL server on '127.0.0.1' (61)
What am I doing wrong?
Some options:
Check the service of mysql is running;
Check the user and passowrd are correct;
Check the privilege of the user, try root user
For Mysql Connection you should have check username and password. and .env file
DB_HOST=localhost
DB_DATABASE=Your Database name
DB_USERNAME=username
DB_PASSWORD=password
Along With that, you can update database.php file for database configurations.
I had to add the port 33060 to be able to connect. Hope that will help others who got stuck like me.
I have some problem with Laravel 7 Homestead. I solve the error with this step:
Use mysql port 33060
Clear laraver config. php artisan config:clear
Reload vagrant vagrant reload --provision
And make sure your database name and password is correct.
Happy coding.
Using Robotframework 2.6.3 and the python database library, I want to connect to MySql Database.
I have downloaded the DatabaseLibrary and MySQLdb however when I try to connect using:
Library DatabaseLibrary
DatabaseLibrary.Connect To Database MySQLdb cts1 root password 172.16.7.20
I get the following error, when I run this using pybot:
OperationalError: (2003, "Can't connect to MySQL server on '172.16.7.20' (10061)")
Note:
cts1 - is the DB name and 172.16.7.20 - is the IP address of DB.
This works when I use mysql under the command prompt. Why would it not be able to connect?
The issue was I did not provide any PORT into robotframework and it does not correctly use the default port of 3306. Once I put the port in, it worked.