Openshift : phpMyAdmin alternative for python mySql - openshift

I created a python app and add mySql as database. I can not add phpMyAdmin . Is there any other visual interface like phpMyAdmin for my python mySql database to interact with it ?

The only reason that you would not be able to add phpMyAdmin is if you are running a scaled application. Adding the phpMyAdmin cartridge is not dependent on what type of web framework cartridge you are using.
If you still can't / don't want to use phpMyAdmin, you can always use port forwarding and install something like MySQL WorkBench locally and use it.
Port forwarding: https://developers.openshift.com/en/managing-port-forwarding.html

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.

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

I get an error EHOSTUNREACH when trying to connect 1 openshift application in NodeJS with MySQL of another openshift application

I have 2 applications on OpenShift: 1 with MySQL, and 1 with NodeJS that is going to connect to MySQL of the other app.
I've seen examples but none of them seem to work, these are the steps I'm taking:
rhc ssh -a mydbappname
then i get the enviroment variables with
env | grep MYSQL
I get something like:
OPENSHIFT_MYSQL_DB_HOST=127.XX.XXX.X
OPENSHIFT_MYSQL_DB_PORT=3306
After that i try to use those on the other app, but it always throws EHOSTUNREACH, no matter if i create the OPENSHIFT_MYSQL_DB env variables on the Node app and use them, or if i put it directly on the code.
I have seen in other parts that the OPENSHIFT_MYSQL_DB_HOST is something like 54d10be2503e36378e0002db-mydbappname.apps.rhcloud.com.
If I use the port-forward and use 127.0.0.1 with the local port selected for mysql, and start the NodeJS application locally it works, only when i upload the changes to Openshift it fails
In this article:
https://blog.openshift.com/sharing-database-across-applications/
You can read:
"Step 1: Create an application with a database
We will create a scalable PHP application using a MySQL database cartridge. In non-scalable applications, the database will be installed in the same gear as the application. In this case we want the database to be accessible from other gears. So creating a scalable application ensures that the database runs in its own gear that can be accessed from other gears."
So maybe this is the problem, check if this application you created is scalable.

Does MySQLWorkbench include MySQL server?

My aim is to create some simple tables in MySQL via a GUI similar to SQL Server Management Studio. In order to do this I found and installed MySQL Workbench.
I am following this tutorial:
http://dev.mysql.com/doc/workbench/en/wb-getting-started-tutorial-admin.html
but on step 5 I get an error message saying cannot connect to MySQL server.
Am I supposed to have something else installed before I can use MySQL Workbench? I have assumed Workbench includes everything I need....
You will need to install MySQL yourself. You can download it individually or using a tool like WAMPserver which makes the process of installing and configuring ridiculously easy.
You will need a server. SO you can goto start->mysql folder->mysql Installer.
After that a Mysql Installer form will open. Click on ADD. You will see a list of
products. Select Server(x86 or x64) based on your machine and follow instructions
provided.Once you have downloaded, set admin password. Now you can create your instance in workbench. If server is not running, run services.msc and start MySQL
service.

How to create a connection with MySQL Admin?

I am extremly new with databases. I have only created one, and that was in SQLite on android. I downloaded MySQL Admin for linux (Ubuntu) and downloaded and installed Admin. Now I want to create a database, but I jave know idea what I'm doing. I created a connection via the drop down menu option 'Open Connection Editor', and I keep getting a 'MySQL Error Nr. 2005' error. Do I have to do something command line wise first to set up the database?
Any help is appreciated.
Aedon
MySQL is different to SQLite in that you need to have some server software running the whole time managing the database. It's that server software that you connect a MySQL client to.
You need to grab yourself a copy of MySQL Server then I'd recommend this tutorial
Good luck!
If you are using Ubuntu you can install MySQL Server easily with this command:
sudo apt-get install mysql-server
and then I suggest you to download MySQL Workbench, it's a GUI Tool where you can do almost everything with MySQL databases (create,drop,alter, modeling, administer the service).
Then, you can create a connection with mysql workbench or mysql admin (or another client) and do your stuff. If you installed the server in your PC then the parameter are something like this:
host = localhost
user = root
password = (the password you specified in the installation)