I have deployed an app on Openshift redhat cloud server. I want to use toad to remotely access my mysql database. I am new to toad and never configured it. I just want to know how can I set it up to access my openshift database? I can create ssh connection to the server using toad, but it requires password and openshift instead provides a private key file to log in to the server. Can anyone help me upon this?
You can use port forwarding to get local access to your database. There's a good blog post on port forwarding here:
https://openshift.redhat.com/community/blogs/getting-started-with-port-forwarding-on-openshift
To get your database username and password, you can ssh into your app and look at the mysql-related environment variables.
$ ssh <uuid>#<appname>-<namespace>.rhcloud.com
[appname-namespace.rhcloud.com ~]\> export | grep MYSQL
You can find the ssh command listed on the app overview page in the console, under the "Want to log in to your application?" link, or by running the rhc app show command.
You'll need to use port forwarding to access the db remotely
Related
I have created a PHP project and I am trying to host it online. To do so, I tried linking my database, which is in local phpmyadmin to heroku server. According to this post How to access remote server with local phpMyAdmin client?, I learned that phpmyadmin can be linked to online remote server by adding a piece of code at the end of config.inc.php file. But I do not know how to get information such as hostname, port and username from my herokuapp. Please help me out here. How to get information such as hostname, port and username from herokuapp?
Typically the hostname would be taken from InetAddress From the standard java library
(.getCanonicalHostName (java.net.InetAddress/getLocalHost))
Your web server will be assigned a dynamic port by Heroku but to ACCESS it, you will need to use the default port (80).
As for the user, you would have set that along with password.
Good luck.
Good day,
I have a VB application which i need to connect its database in xampp/mysql..
But mysql/xampp is installed to other computer which is networked at my computer.. What will I do?
The MySql server with XAMPP is no different to any other MySql server , with the exception of the interface; it looks a little bit different. If you want to be able to connect to the server, you need to know the server's internal IP address (you can find it with CMD > ipconfig). The port will generally be assigned to 3306, so you shouldn't have any issues there.
If you want to grant access to the server from your computer, open up the XAMPP control panel (from the other computer) and click Shell. Type in MySql and you'll be able to execute commands, from there (which you can use to grant remote access).
There is a server I wish to connect to. It has multiple VMs running on it each VM has a mysql DB. I can currently connect to this server using ssh and then connect to any of the databases from each VM using mysql -u user -h host -p password. Now I want to connect to the same MySQL DBs using MySQL workbench from my local machine. However there is firewall, currently I use putty to get passed the firewall with public private key authentication and I can access any machine I want. I have seen here that I must install a MySQL server locally ( I've done this I am using mysql workbench) and use the loop-back address, in that way you don't need to access an external server. Could anyone point in the right direction on how to do this?
You need to use ssh tunnelling.
In putty under the options go to Connection->SSH->Tunnels. Add a tunnel from source port 13306 to Destination localhost:3306.
You can do this in Putty either before or after you connect. It's best to do beforehand and save the session configuration otherwise it gets tedious having to re-enter the settings.
In MySQL workbench connect to localhost port 13306.
There is a good guide with screen shots here: Setting up an SSH tunnel with PuTTY
An SSH tunnel makes a TCP port on your SSH client machine and directs any traffic to whatever the destination is set to. You can add multiple tunnels, but each one must listen on a different source port number.
You can forward the port via SSH.
ssh -NL is your friend like so:
ssh -NL 3306:localhost:3306 <yourserver>
Then you can point your workbench at localhost.
You don't need any additional software for this task. MySQL Workbench can create SSH tunnels on its own. Watch my tutorial on Youtube how to create connections: https://www.youtube.com/watch?v=DCgRF4KOYIY.
It essentially comes down to creating the right connection type. There is a drop down that allows you to select an SSH connection. Enter the parameters which you used to connect via Putty.
i am using openshift free tier (3 gears). My scalable app uses PHP and MySQL. But unavailability of phpMyAdmin credentials for 3 gears scalable app it's difficult for me to access Mysql table entries. My question is can port forward feature of Openshift is used to access openshift Mysql via locally installed wamp phpMyAdmin.
Yes, it is possible to use port forwarding to access your OpenShift database from your locally installed PhpMyAdmin.
First, make sure you have the Redhat Client Tools (RHC) installed on your computer. If you haven't, download them here: https://www.openshift.com/developers/rhc-client-tools-install .
In order to connect via SSH, you will need a public/private key pair. Again RHC can automate most of this for you when you run rhc setup. The application will ask for your credentials, optionally create an SSH key for you and upload it to your cartridges. Make sure to protect your SSH key with a secure password. This process is described in more detail at https://www.openshift.com/developers/remote-access .
You will need a SSH client. OpenShift recommends Putty for Windows users; detailed setup instructions can be found at https://www.openshift.com/page/install-and-setup-putty-ssh-client-for-windows . In addition I would recommend to install OpenSSH from Cygwin, as this makes it easier to forward the port to your database later on.
Use Putty and your SSH key to connect to your server via SSH. Once you are at the shell, type env to view a list of environment variables on the server. Look for the variables that end with _DB_HOST, _DB_PORT, _DB_USERNAME and _DB_PASSWORD and make a note of their values on your Windows machine. The names and meanings of all of these environment variables are described at https://access.redhat.com/site/documentation/en-US/OpenShift_Online/2.0/html/User_Guide/Database_Environment_Variables.html .
To forward the port, use Cygwin's ssh command. For example:
ssh -f user#my-app.openshift.com -L 3307:DB_HOST:3306 -N
You will have to replace user with your OpenShift username, my-app.openshift.com with your public OpenShift hostname and DB_HOST with the IP address from the ..._DB_HOST environment variable that you looked up above. If this command succeeds, you should now have a tunnel from your local port 3307 to the MySQL server at OpenShift. Thus, you can create a new database connection in PhpMyAdmin's configuration with 127.0.0.1 as the server, 3307 as the port and your credentials, which you got when running the env command via SSH.
Before you open the session with Putty, go to the Connection-->SSH-->Tunneling.
There add a port, for example, 3333. And set as destination the url of your remote mysql server and port, for example: 324324343455435435-yourservices.rhcloud.com:44351. Click on the "Add" button. Save your session and connect.
Once connected you can use whatever the client and connect to localhost on the port 3333 with the user, password and database name given by the env vars as the other guys said.
I connect with Toad for Mysql with no problems.
You can use the rhc port-forward command, similar to what i described here: OpenShift: How to connect to postgresql from my PC
instead of phpmyadmin.SQLyog from webyog has ssh tunneling option. which work fine for remote accessing openshift mysql
You can add this cartridge to have phpMyAdmin support in scalable apps:
https://github.com/arielscarpinelli/openshift-scalable-phpmyadmin
I am very new to this server setup and database connectivity. I googled a lot but couldn't find the solution for it.I am developing an android application which needs to post data to remote database. Which is done.
Now i have to setup MySQL Database in the new Windows Server 2008. I have installed and managed to get access the root user(Which is fine). Now i want to access this database from my local computer[Which is iMac]. I already set the privileges by following this link. When i tried to run from my web application it shows the following error.
Error: unable to connect to database. Host 'xx.xx.xxx.x' is not allowed to connect to this MySQL server
Here is my questions
1.) How to get access to the remote MySQL database from any computer?
2.) How to run the web application in the server?Like Web Hosting i.e Do i need to setup ftp account and put the stuff over there?(For Eg: testhost.com/connecttodatabase.php by executing this it will execute whatever code in testhost server. But i have no idea how to do that for my server).
Any help is much appreciated.
Alternately, You can also try...
use the_database_name;
GRANT ALL PRIVILEGES ON
the_database_name.*
TO
'the_user_in_php_code'#'%'
IDENTIFIED BY
'password_of_the_user_in_php_code';
FLUSH PRIVILEGES;
source:
http://forums.devshed.com/mysql-help-4/host-is-not-allowed-to-connect-to-this-mysql-server-366908.html