Hi I am trying to connect to my MySQL DB which is hosted by strato. On their site I can create a DB and I did. Now I am trying to connect to the database via NaviCat but I keep getting error 10060.
A screenshot of the strato website: screenshot strato webportal
A screenshot of my trying to connect to the database in NaviCat: screenshot NaviCat
And last but not least a screenshot of their website with an tutorial on how to connect to the DB: link to page
Maybe you're wondering why I don't contect the host, it takes ages for them to reply...
What am I doing wrong why cant I connect how can I fix it?
EDIT/UPDATE
I now setup a SSH tunnel but when I am trying to connect it still gives me this errorlost connection to mysql server at 'reading initial communication packet' system error 0
I am able to connect via PuTTy like shown in this link. And a found the port, hostname etc as you can see
But once I fill that into NaviCat, like this
and this
but still no luck :S now gettings this error:
If anyone can help me i would rlly appreciate it!
My guess is that Strato is blocking outside access to your database. Which is 100% good. Allowing internet access to a database is generally a bad idea.
You can connect to the database by SSH'ing to the server and then using mysql CLI. Instructions are provided in the link you shared in the SSH-access to the MySQL database section.
Using SSH you can also port tunnel to allow your remote connection with your client. This is a slightly more advanced technique where you link up a port on your local computer (localhost) to a port on the remote machine to which you are ssh'ing.
In PuTTy put in the server name like their instructions suggest:
Then go to SSH>>Tunnel in the left-hand menu. Fill out your Source Port (the port your local computer will be listening on) and your Destination (The server:port on the REMOTE computer that you are forwarding traffic to through the tunnel):
I'm using local port 66306, you may use whatever port you want as long as it isn't be used on your computer. Click "Add" and then Open the connection and put in your username/password when prompted. Refer to that Strato help doc if you get stuck.
NOW... in your mysql client (Navicat) you are going to connect your database. Because you have a tunnel open forwarding traffic from YOUR computer's 63306 port (or whatever port you chose) to the remote computers 3306 port you will specify in Navicat:
Connection Name: Whatever
Hostname/IpAddress: localhost
Port: 63306
Username: strato db username
Password: strato db password
Now it should connect. Strato sees your traffic as if it's coming from their server because of the tunnel and it will allow you through.
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.
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'm trying out Azure for the first time. I followed this guide to create a web application with a MySQL database.
So the DB node was create and I can see it in my resources and I can view the credentials in the properties. However, I can't connect to it from my desktop.
It looks like a firewall issue as I'm unable to telnet to it:
telnet us-cdbr-azure-west-c.cloudapp.net 3306
Trying 104.209.43.4...
telnet: connect to address 104.209.43.4: Operation timed out
telnet: Unable to connect to remote host
Can anyone tell me what I'm doing wrong?
Thanks in advance.
Usually, this issue is raised due to IP or Port is blocked by firewall.
As the comments show that others can connect to your MySQL server, so I think we can exclude that server side firewall blocked your IP and Port.
If you are in a protect network environment, check whether the gateway of network has a white list and your MySQL server endpoint is in the list, or whether the gateway has block the 3306 port. You can change a network environment if possible to check this.
Another attempt is that you can change a PC to have a test to connect to your MySQL server. If it could work, you can compare with the successful PC firewall configuration.
I am not sure if the terms I am using are correct so ask for clarification if you need :).
Anyways, I am hosting through HostEasySolutions (Server A). It comes with a MySql database, using PHPMyAdmin as the frontend. On Server A, I added some PHP files to access the database, and it works fine.
If I copy the php files to my other server, through DreamHost (Server B), I cannot connect to the database. I get the error: Can't connect to MySQL server on 'combinedsystems.ca' (110)
In the cPanel on Server A, I added the IP for Server B into the Remote Database Access Hosts, I also just added the wildcard '%', just to see if I could get it working...but still it can't find the server.
I am not sure what is going on, as far as I can see there is no firewall.
The only thing that stands out to me, is that if I go to PHPmyAdmin for Server A, it says Server: Localhost via UNIX socket, where as for Server B's PHPMyAdmin, it says: Server: mysql.pdem.info via TCP/IP
Most (all?) hosting companies have port 3306 closed on the firewall.
What you need to do:
adding remote database access in the database
edit my.cnf to listen on all interfaces. Default mysql listens only to localhost
most of the time you are out of luck! Even if there is no firewall (would be very unsecure) you have no access to my.cnf
How can I connect my localhost PHP files to my remote server MYSQL database?
For example: if we download WordPress, and it gives us an option to login, so that our login credentials are saved with WordPress but still our localhost files connects to that database.
How do I do that?
Thanks.
If you want your PHP code to connect to a remote MySQL database, you just have to specify that remote host when calling the function that connects to MySQL.
For example, when calling mysql_connect(), don't specify localhost as first parameter -- but your real remote host.
Same with mysqli::__construct() or PDO, of course.
A couple of notes :
Your remote host must accept connections to MySQL (think about the firewall)
Your remote MySQL database server must accept connections from non-localhost
Sending queries, and fetching results, to/from a far away server will be a lot slower than doing so on localhost !
mysql_connect(SQL_IP, SQL_NAME, SQL_PASS);
Well when you install Wordpress set the host to be the IP of your remote server. If this isn't what you're looking for, please reword your question. If you're not using word press, check ou the PHP documentation for mysql_connect. The first parameter is the host. Enter the IP or hostname of your remote server here. And then follow that with your username and password.
mysql_connect('remote-host', 'myuser', 'mypassword');
Note: Some hosts do not allow remote connections to MySQL. Check your remote server doesn't have 3306 firewalled or only instructed MySQL to bind it to 127.0.0.1.