How to connect mysql when deploying node app on heroku - mysql

I have already deployed my node app with heroku which is working fine with my local phpmyadmin database but how can i use it without starting mysql on local machine.
OR how to connect my node app deployed in heroku with phpmyadmin(mysql2)

You shouldn't use local MySQL database in the production app which you have deployed in a hosting provider in this case Heroku.
You could create a remote MySQL database resource from providers like db4free.net.
Update your code to use database credentials of the remote database and start using it.
Note Heroku also provides a MySQL service. You could set up your database there too if you need.

Related

Connecting to MySQL database located at (pythonanywhere.com) from app located at (heroku.com)

I created a webb app and deployed it at Heroku. So far, so good. Now I need to integrate it with the MySQL database which is located at pythonanywhere.com.
I tried the following command (which is what I managed to find when googling for accessing a remote MySQL database from Heroku):
heroku config:add DATABASE_URL=mysql2://PYTHONANYWHERE_USER:DATABASE-HOST-ADDRESS/DATABASE-NAME--app HEROKU-APP-NAME
Whenever I run this command from the console in Heroku, I get the following message:
bash: heroku: command not found
Have anyone tried connecting to a pythonanywhere MySQL database from Heroku before? Can you show how you did this step-by-step?
The reason why I want to access the PythonAnywhere database (and not just host it on Heroku) is that a lot of the backend is written on PythonAnywhere and stored on that database.
Thanks,
The heroku command is provided by the Heroku CLI, and should be installed and run from your local machine. Running heroku commands directly from a dyno (e.g., via heroku run bash) won't work.
Once you've set DATABASE_URL using heroku config you should be able to access it from your code via process.env.DATABASE_URL.

could not access azure mysql

I have a MySQL server database running on Azure. It has already running to store data from my ASPX web apps hosted on Azure also. I have plan to migrate the apps to Java JSF or .net core.
I developed using Tomcat server (in my local pc) and try to connect directly to mySql in Azure. But I always get Communications link failure error.
Is it not allow to connect directly from my local Tomcat server to database in Azure, or something else?
Thank you in advance for the answer.
Yes you can connect from your local tomcat to your azure mysql if you have provided the correct connection string.
Also add your ip in the firewall rules of the sql resource.

Database server accessed is the client's Database connection

I am trying to setup a local server for testing which I am planning to host the following:
Spring-Boot Application for the Backend Application (port:8080)
Angular 4 App for the Frontend Application (port:4200)
MySql Database for the Database (port:3306)
When I am trying to test using the local server, everything works fine.
The problem occurs when I try to access the server from another PC. I can't seem to access the MySql Database of the server from another PC through my frontend app.
Problem:
access using the server:
localhost:4200/login - able to login (connects to the server's MySql DB)
access using another PC:
192.168.179.18:4200/login -unable to login (connects to the other PC's MySql DB)
NOTE: 192.168.179.18 is the server's IP address.
It seems that when I try to access the frontend app from another PC, it is trying to connect to the other PC's local MySql Database.
How do I configure this so that where ever I access the server, it will access the server's MySql Database??
btw, my application.properties looks like this:
spring.datasource.url=jdbc:mysql://localhost:3306/my_app_database
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.database=mysql
spring.jpa.hibernate.ddl-auto=none
I found the cause and a solution. It turns out that in the FrontEnd App, it is hardcoded there to connect to localhost:8080 so where ever I access it, it will try to locate localhost:8080. When I was testing this, I was running the backend app(port 8080) on the other PC that's why it accessed the other PC's MySql Database.
What I did was changed the hardcoded localhost:8080 to 192.168.179.18:8080 so that it will communicate with the backend app on my server.

Run mySQL on Server with Django

I'm new to web development and I'm trying to go live with my website. Currently I can run MAMP mysql and then in the django app I can run 'python manage.py runserver' to run a virtual version on my system.
Currently I have uploaded (rsync) my django files to the server. How do I upload and run my mysql server on the web server? How do i dictate the domain? I know before that the domain was 127.0.0.1......
THanks
127.0.0.1 is localhost, so if your code is hosted on a remote server you can still access the db with that host. You need to first make sure MySQL is installed on the server. Once that has been taken care of use the MySQL terminal to create your db, its as easy as that.
Here is a useful page of MySQL commands:
http://www.pantz.org/software/mysql/mysqlcommands.html

Host MVC Application in AppHarbour

I've hosted MVC application having MySql server instance in AppHarbour as backend but build is getting failed. We would like to connect MySql instance from local application but it can't access tables and schema while is opening and connecting to instance successfully.
You can't connect AppHarbor to a local db. If you have a hosted MySql instance though, you can connect it to that.
AppHarbor shows you build errors. You can read the build output and find out why it is failing (if it is the build failing or unit tests failing).
Either way, whether or not MySql is hosted or local, that shouldn't affect whether or not the project builds in AppHarbor.