How to deploy local MySQL database to Heroku using nodejs - mysql

I'm new to using Heroku and I have a nodejs app in which I plan on using a MySQL database as the main data store and please tell me how setup mysql in heroku

You need to use an add-on for this. There is one for MySQL provided by ClearDB.

Related

How to switch from MySQL to Postgre on Heroku

I want to host a django project on heroku. Locally, I developed it using MySQL database. And I have also pushed it to heroku but I get an Error message whenever I run heroku open command on command prompt. The error message is Can't connect to local MySQL server through socket. Though I'm a newbie in using databases, the way I understand the error is that heroku can't connect to local MySQL server which I'm using for local development. I don't want to connect to a remote MySQL database, instead, I want to connect to Postgre database just as heroku recommended.
Being a newbie in the use of database, I don't know the best way to migrate to Postgre or how to add MySQL in my project to .gitignore. Is it possible for me to start running Postgre on heroku while MySQL isn't added to . gitignore and is still the database in settings.py? Must I clear MySQL database or add it to gitignore before I can use Postgre?
PostgreSQL settings for Heroku:
Please install dj_database_url using below command:
pip install dj-database-url
In settings.py , import dj_database_url and add below settings at the end of the file:
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
Done !! Now, deploy again to Heroku.

Migrate RDS to Aurora MySQL with Ruby on rails Elastic Beanstalk

I have a Ruby On Rails App on Elastic Beanstalk with MySQL RDS, and I want to migrate it to Aurora MySQL, I could migrate my database and I have the new endpoint of Aurora MySQL, I first tried to connect it in my development environment to check if everything was going good, but when I try to deploy in production I got an error by elastic beanstalk "12_db_migration.sh failed.", but It does not have sense because I connected the database in development and It worked, It looks like if elastic beanstalk couldn't connect to the database, all credentials are correct. There are not pending migrations, and the error message does not have sense. Something important is that my previous MySQL version is 5.7.24 and the MySQL version of my new Aurora MySQL database is 5.7.12, but I think It doesn't matter because in development worked well.
Thank you.
okay, I could fix it, the problem was that I was written my credentials in database.yml file without using environment variables, I was testing something and I didn't use environment variables, and It looks that I cannot do that, I use environment variables in the file and everything worked.

How to import a MySQL db to OpenShift?

I've been working on a JSP project and now I want to host in on Openshift. Everything is set up except for the database. I already added MySQL 5.5 cartridge and phpMyAdmin 4.0 and I edited the credentials in my project as shown below. But how can I upload my database data to the application?
Constants in my project
Apparently, the key was to replace the variables in the DB URL with the openshift variables.
To upload your data into your database you could use a tool to manage you tables (for example Squirrel-SQL). To connect it with your openshift-database enable the port-forwarding through your rhc console so you can access the database as it would be a local one and connect to it through squirrel. (you cannot connect direcly to the remote database from openshift - only with port-forwarding)
rhc <app-name> port-forward

import to cleardb from existing MYSQL database

I have created a Microsoft Azure asp.net website and also leased out a mysql cleardb database. Is there a way I can import all the tables which I have created in my local MySQL database into cleardb cloud database?
I also could not find out how to create a table in ClearDB on cloud. I am a newbie and any help is appreciated.
Install the phpMyAdmin site extention from the Site Extensions Gallery to your Web Site.
Using phpMyAdmin you can export/import database. And you can also execute database queries (such as CREATE TABLE or SELECT ..., any DB queries).
For your local database, you can use various tools to generate export script. Like MySQL Workbench, which also supports export/import functions.

How to tunnel for MySQL using vmc in cloudfoundry?

I'm just starting out with CloudFoundry and I understand that the only way to be able to execute a sql dump against a db is to
Create MySQL service
Bind Service
Tunnel to the service
But I'm not getting any luck on the last part. I followed the directions from cloud foundry forum discussion
I select option 1. None But I just don't know how run
mysql --protocol=TCP --host=localhost --port=10000 --user=ub2sCBQ0mGsVZ --password=pRXana7vEOX0C df83386088ffc4f8d8cf288791d22fb99 < sample.sql
from command line (Windows) or from SQLyog.
The other part of the question is of course once I am able to create the database and the tables and insert data into them. How does my webapp need to connect to the database?
On one hand I think I know the answer as described here
But I can't believe that this is the only way. This is damn difficult with Spring because I would have to read the env in before the entire Spring/Hibernate machinery starts creating the needed beans. Is there an example of less complex way to do this ?
if you are using Windows I would suggest using MySQL workbench to connect using the credentials provided when opening the tunnel using VMC. You can download it from the MySQL website here;
https://www.mysql.com/products/workbench/
When deploying a Spring application that uses a MySQL service you can have it automatically configure the database connection in your app. See the following page for details;
http://docs.cloudfoundry.com/frameworks/java/spring/spring.html#determining-whether-your-application-can-be-auto-configured