I have a local PostgreSQL Database for my Discord Bot on my PC and want to update to my Heroku Application. I have added the Heroku Postgres Addon, but don't know how to upload the Database. I can't use the Amazon Web Services as told in the devcenter since i don't have any Credit Card. Is there any way to upload the Database without AWS? Thank You and sorry for my bad English
You can dump your local database contents to a SQL file with pgdump. Then you can access your Heroku database from your local machine and upload your SQL using the psql command-line client. Get the access url like this from the Heroku command and put it into your client program.
heroku config | grep HEROKU_POSTGRESQL
Know this: sometimes Heroku migrates your data from one host machine to another. When they do that they change your access url. So retrieve that url again whenever you use the psql client.
Related
I am working on a job interview exercise to create a React CRUD application and a PHP API that accesses a mySQL database. The work is to be done on their work server environment that I have to SSH into.
How do I choose which port of their that I want my API to "live" on and then run it so that it accesses their phpmyadmin mySQL server? Then my React application must then run and access the API. They have given me their phpmyadmin port, and a port to use for my UI, and say I must choose the API port.
I was able to create the React app and API on my local machine and have it access my own local my phpmyadmin mySQL running on my local WAMP server. However when trying to run it on their remote environment I ran into a few problems. One of them I believe was running the PHP API through SSH. Do I have to set up tunneling or something? How can I run them both through SSH and have them know which ports theirs to use?
Do you foresee any other potential issues I have not mentioned? More details inc.
Thanks
I was working on my project that was using remote heroku postgresql database, that was working fine. Actually, I was using the sqlalchemy library to connect to remote database and I was also used to queries that remote database through my Ubuntu terminal by using psql name_of_remote_database_url command. But after sometime it is giving me a bundle of errors.
And my project was on flask web application now, I am getting errors from this also.
enter image description here
I tried so much but I failed so, that's why I am posting my question here! If anyone knows then plz explain!
pg_hba.config something looks like this
Please read following Heroku support information:
FATAL: no pg_hba.conf entry for host "…”, user “u…”, database “d…”,
SSL off
You are attempting to establish a database connection without SSL. SSL
is required for all connections. Please see the documentation for your
postgres driver on how to establish encrypted connections.
Recommended solution:
Heroku Postgres & SSL
Actually, I was using remote heroku database url. After sometime, heroku did maintenance of my database and changed the url and I was considering the problem related to my system, but it was not related to that.
When I visited my gmail there was written in the heroku gmail that we changed the url of your remote database during maintenance.
Now, it's working fine!
I have project on my local computer. I want to test my db online on 000webhost. I set .env file like this
.env
and I had error like this
error
thanks before
If your database is hosted on an external server / hosting service (e.g. 000webhost) then your database DB_HOST in .env won't be "localhost", it would be something like this:
mysql#.000webhost.com
Where the # is number of the allocated database server for your site.
Typically, when you create a new database, they show the database access details, use those details.
I have a small asp.net core website that I push to my server via jenkins. Jenkins does git checkout and then dotnet restore and dotnet run. It works for the website, but I added entity framework and I'm a little confused. How exactly do I move my local database to the server? Or should I create one on the server and then reference it?
I have one mssql database on (localdb)\MSSQLLocalDB, but when I run the server and try to go to a page which gets data from the database I get 500 Internal Server Error.
I would like to have one local db for testing and one on the server, but I just can't wrap my head around all of this.
Well in development, you should write a init script for your database. This will create all the required stuff your application needs.
So in linux...
Install the MySQL, get the users set up, and init the database.
In your application...
Provide the connection string for the DB installed in Linux.
I am not running my app in c# but this is similar to my node app. That is what I do. I develop in windows with Postgres. Then my prod is on a GoDaddy Linux cloud server and I have Postgres installed in that. When I do my git pull for the latest, I don't have to change much because of the .env file for my environment variables.
Now that I've deployed my webapp to Heroku, how would I be able to browse the database as it's altered over time?
Try heroku pg:psql. For instructions for how to do this, see this.
If you want to browse your Heroku PostgreSQL database using a browser there is now a free tool for that called Heroku Data Explorer:
https://datazenit.com/heroku-data-explorer.html
It uses Heroku API in real time so your data/credentials stay secure and private. Also it has excellent performance because Heroku local network is used for database connections.
Download PgAdmin 4 and configure your heroku database credentials. Right click on Servers link and choose create >> server. On General tab give Name as per your wish and on Connection tab enter Hostname/address, address, Maintenance database (database name), Username and password which is given in Heroku dabase credentials page. And you will be able to access heroku dadabase on UI free of cost.
I use a tool called Adminer to connect to the DB. The problem is that Heroku will change the credentials for the DB occasionally. You can find them by visiting the Resources tab on your Dashboard then clicking on the DB you use.
It will take you to the Addons page in another tab. Click on the Settings tab then View Credentials.
Using these credentials, you can use Adminer to login to the DB.
Install Beekeeper Studio. Connect to POSTGRES_URL of Heroku with "SSL" enabled.
Easy to view