I want to "use Google Cloud SQL Proxy to connect to another vendors database"
(Vendor's database is not stored in GCP, It's simple mysql database hosted in another server)
since I have to update data in vendor's database, my project stored in GCP (hosted separate from vendor's) so:
Is there anyway to connect to external database from GCP app (Laravel 5) Or any other way to solve it except developing web APIs (vendor won't prepare us the APIs since some contract/budged reasons) ?
After I tried to connect to the external DB (set connection in both .env and config/database.php), then the error message alert like:
Access denided #'cloudsqlproxy'
PS. My project can connect to vendor's database as usual from localhost but after deploy to GCP then 'cloudsqlproxy' error's occur.
I'm a newbie one for GCP so
thank you for all community's help,
Related
Right now I have a localhost database using WAMP server.
I connect and insert data to this DB by making a POST request to the file's PHP link (e.g localhost/sensor_data/connect_To_DB_And_Insert_Data.php).
I want to do the exact same thing with Azure SQL so my database won't be local anymore but on a remote server.
I have already created a database but I don't know how to upload a PHP file that can be accessed online using a link. There are so many documentations that I'm kind of lost and I didn't find an answer to this yet.
So my question is, how do I upload a PHP file on Azure, that it can be accessed by a link, so I can insert data to the database by making a post request to that link ?
Firstly, you just need to change the connection string in your PHP code. Then your PHP application will be able to connect to Azure SQL. In this way, you do not need to create any Azure host server (Web app or VM).
You can get the connection string on Azure portal:
Attention, as Azure SQL has enabled firewall. So, if you want to connect to it from your local server, you need to add your IP to the allowed IP list
However, as #UkraineInTheMembrane suggested in the comment, you can also to use Azure Web App or VM to host your PHP application.
With Azure Web App, here is a get-started tutorial for PHP: Create a PHP web app in Azure , in this tutorial, git is used to manage your code.
There are also many other approaches to upload your code to azure web app: https://learn.microsoft.com/en-us/azure/app-service/deploy-zip
I have created an App Service and SQL Database(created new & blank sql db) on Azure to install OctoberCMS. I have got as far as the Database install page and after inputting my credentials I created earlier when creating the DB and I get an error saying my new database is not blank.
Database "DatabaseName" is not empty. Please empty the database or specify another database.
There is a problem with the specified Database configuration.
I have been playing around with various configuration bits on azure for quite a while now and I'm just tearing my hair out trying to work it out. Any help would be greatly appreciated and if any more info is needed let me know.
I was able to install to Azure Web App and Azure Database for MySQL. High level steps are:
1. Create Azure Web App, ensure App settings are set to use PHP 7.0 or
higher
2. Deploy code through Kudo Zip Deployment (or whatever method you are comfortable)
3. Create Azure Database for MySQL
4. Browse to Azure Database for MySQL -> Connection Security
5. Click + Add client IP
6. Allow Access to Azure Services = ON
7. Enforce SSL Connection = DISABLED
8. Use whatever tool you like to create MySQL DB, I used MySQL Workbench.
9. Browse to https://<yourwebapp>.azurewebsites.net/install-master/install.php
10. Use info from Azure Database for MySQL -> Overview to fill in DB values
Reference:
https://learn.microsoft.com/en-us/azure/app-service/deploy-zip#deploy-zip-file
I have developed an application using the PHP SDK for AWS. It is hosted on AWS also.
I have written a connections file, detailing all the variables and credentials required to connect to the DB, and this works fine.
However, in terms of security I was wondering if it is possible to use an IAM Role, as that is what I am using to connect to the EC2 instance, so that I am not explicitly defining the credentials?
I created multiple REST api's for my website on a local server(wamp) and now i am trying to move it to a online server(aws elastic beanstalk). My question is where do i build my database with the tables and rows etc just like in phpmyadmin? I figured that "upload and deploy" means upload the php file i made but when i do i get an error saying "health degraded". So what i want to do is basically move my local server to an online one with aws EB. I watched a bunch of videos and did a lot of research but can't seem to find the way to go about this problem.
My question is where do i build my database with the tables and rows
etc just like in phpmyadmin?
You can connect to the RDS instance created by beanstalk using a Database Management Client Tool like MySQL Workbench, Heidi SQL & etc using the DNS name, created for RDS instance. However one challenge you will face is to access the RDS instance from your client machine, since its not a good practice to make the Database publicly accessible. You can create a EC2 instance (Windows or Linux with GUI) inside the same VPC, connect to it (Remote Desktop or SSH) and install the tools so that you can use the tools inside the server, to connect to the RDS instance.
I figured that "upload and deploy" means upload the php file i made
but when i do i get an error saying "health degraded"
To understand the structure in code inside the Zip file, I would recommend to create a Beanstalk environment with a sample project available in Beanstalk and download the sample project artifact (Zip file) from S3 so that you can compare the project structure requirements.
If you prefer to go through the documentation, you can refer this. If nothing goes well, connect to the ElasticBeanstalk provisioned EC2 instance (Either using Remote Desktop for Windows or SSH to linux) and investigate the deployed artifacts.
I am trying to connect to my google cloud SQL database from my Laravel files which are in Google App Engine but I get the error shown in the screenshot below. I have my username, password and all required details in my .yaml file. What could I be doing wrong?
The problem was with my hostname. I was using localhost instead of my SQL instance's IP.