Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It does not answer questions about the SQLyog program as such. But we experience quite often that SQLyog user having problems in getting the connection to one ore more MySQL servers working are missing the basic understanding of the TCP protocol that is used for connection. So this is a 'background article' that supplements the more typical FAQ items here.
The TCP protocol needs an ip IP to connect to a host. An ip IP is a group of 4 2-digit hexadecimal numbers. Like '0A.1B.2D.3D'. It is common to express this in decimal format 'v.x.y.z' where v,x,y and z are numbers between 0 and 255. To get your own ip IP in this format just type (on windows) 'ipconfig' on a command-line and the ip IP is returned.
The ip IP returned can be a global ip (accessible directly from the internet) or - if you are behind a router - a local ip that only applies behind the router. All computers behind the router share the global ip of the router itself. The router has the functionality to ensure that communication from each machine behind it to and from the internet works.
The TCP-protocol communicates on 'ports'. There are about 65.000 ports possible. A TCP-port is nothing physical but just a number that each 'packet' of information that is sent is coded with. Various ports are reserved for various server programs and programs with sort-of server functionality. The complete list is hereHere, you can review the complete list of

Newtab2
aliasService Name and Transport Protocol Port Number Registry
urlhttps://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
:
So to access a MySQL server (running on the standard MySQL port 3306) on the ip v.x.y.z the client must ask for connection to the server 'v.x.y.z:3306'. The Internet can handle this. This is the basically how the Internet and the TCP-protocol works! Pretty simple actually! And there is one basic rule more: the ip 127.0.0.1 is always any computer itself!
However you probably never enter internet addresses that way no matter if it is a website, an FTP-server or a MySQL-server that you access. You use NAMES. However these names must be resolved to the above format. If not resolved to ip's the servers on the Internet can't handle the request.
There are basically four ways of resolving a name to an ip IP(and in that order):1) using

  1. Using client hosts' file

...

  1. Using (local) nameserver lookup

...

  1. Using Domain Name Server (DNS) lookup.

...

  1. Using Remote Network routing (using either simple routing based on ports, hosts file or nameserver) on remote network.

1) . Client hosts' file
There is an excellent article on the hosts file here. Try to find your own hosts file. You will find this line in it:

...

127.0.0.1 cutie

to your hosts file!
2) . A local nameserver.
A local nameserver can be installed explicitly or implicitly. If you have more windows computers connected on a windows' network (using the TCP protocol - not old NETBEUI protocol etc) you already have a local nameserver that was implicitly installed. If you have two machines on your network named 'Bonnie' and 'Clyde', then you can connect to the MySQL server running on 'Bonnie' from the computer 'Clyde' with SQLyog entering 'Bonnie' as the host name. Because the nameserver that was implicitly installed as a part of the Windows network resolves the name 'Bonnie' to 'Bonnie's ip on the network
3) . A Domain Name Server
Domain name Servers are part of the Internet structure. Any name/string in the format domain.topleveldomain (ie: school.edu, business.com, whisky.org etc. ) can be looked up on the Domain Name Servers of the Internet. The ip returned is then used for creating the connection.

A typical example

...

You connect to a remote server with the host name 'mydb.thisismyisp.com'. What happens here? Simply:

  • First: local hosts file is checked if there are any matching entry. if not proceed to step 2.
  • Second: local nameserver (if exists) is checked if there are any matching entry. if not proceed to step 3.
  • Third: Domain Name Server lookup identifies the ip of domain-

...

  • host thisismyisp.com

...

  • Fourth: local network routing systems (router, nameserver or hosts file) on the remote network identifies the local

...

  • IP mapped to name 'mydb´'

Voila! 'After following the previous steps mydb.thisismyisp.com' is resolved to ip v.x.y.z on the internet and ip IP a.b.c.d on the remote network. Once connection is established the routers and other networking gear in the complete communications chain keeps that information until it is closed or times-out due to inactivity (or some error occur!)).

One more detail, when And finally let me remind you of one detail: When connecting to the MySQL server at an ISP it is common practice that MySQL user names and MySQL database names must be prefix'ed prefixed with the domain user name (the one that is used for FTP for instance). Like me_username and me_mydb. Simple because other users may have created a MySQL user username and a MySQL database mydb. But failure to do so does not result in a connection error, but an authentication error! . Also note that MySQL usernames can be up to 16 characters long only. Read this, review the error "I have a very long username for the MySQL database at my ISP. SQLyog won't let me use it" that is listed below.

Nevertheless, everything can get 'messed up' if it is the first time you try to connect to a remote MySQL server! And here even tunneling is not involved!.

What should I enter as 'hostname' when connecting to a MySQL server at an ISP.

It depends on the systems and the network settings at your ISP. The systems that ISP's operate are too numerous to mention. Some operate almost all their server programs on one very powerful (UNIX-) machine, others operate a network of many computers that are basically pcPC-type hardware. Some use Linux/Unix operating systems other Windows server systems (and some mix it!). And ISP's vary in size from 200 customers to 2.000.000. They can't all operate the same systems!
But the general answer is that probably the ISP operates some nameserver name server internally. Such nameserver name server will typically be configured with the some name like 'mysqlserver' pointing to the ip of the mysqlserver on the local network.

  • Direct connection:

If the ISP has the domain name thisisanisp.com then with direct connection you will use

...

mysqlserver.thisisanisp.com

...

.
The information about the name assigned to the mysql server and thus the exact URL to the MySQL server usually is available as part of your account info from some web-based control panel application. Most likely it is something like 'mydb1.thisisanisp.com' or 'mysql.thisisanisp.com'. If you

...

cannot find the information yourself you will have to ask the support/help desk there.
It also could happen that you could simply use

...

thisisanisp.com

...

or the global

...

IP of the ISP, and traffic on port 3306 is routed to the MySQL server - but it

...

will not always work - particularly not if it is a big ISP!. But everything here depends on the local routing systems used at the remote host - whether port-number based routing is active or not.

  • HTTP-tunneling

...

  • :

With HTTP-tunneling 'host' can simply be 'mysqlserver' (ie: 'mydb1' or 'mysql' or whatever). 'mysqlserver.thisisanisp.com' will work too, but there is no need for an extra domain lookup! If it is the same computer that runs the Web-server (with PHP-interpreter) and the MySQL server it can also be 'localhost' or the ip '127.0.0.1'. PHP will connect to MySQL through a Unix-Socket if 'localhost' is specified and TCP if '127.0.0.1'. Both will normally work. TCP may be a little bit slower on Linux machines than Socket, so you can try 'localhost' first. However there are situations where 'localhost' will return an error like error: 'Error No. 2013: Lost connection to MySQL server during query'. This is likely because PHP looks for the socket file where it does not exist. The underlying reason could be that MySQL and PHP have been installed from different repositories using different file positions for the socket file and the mysql datadir.

  • SSH-tunneling.

With SSH-tunneling there are two hosts' settings:

...

  1. The 'MySQL Host Address' on the Server Tab on the connections manager: Here the 'host' is the 'path' to the MySQL-server relative to the SSH-server on the remote local network. Most often 'localhost' will do. If it does not work and 'mysqlserver' does not either you will have to ask the support/Sys Admin for more information. There are lots of possible ways to configure SSH on a network! Also here if the MySQL host as entered here cannot be reached from the SSH-server the MySQL client error: 'Error No. 2013: Lost connection to MySQL server during query' occurs. Thus this can be caused by an erroneous 'host' entry, but it can also be a network/configuration error on the remote network. Or the MySQL server simply could be down.

...

  1. The 'SSH host' on the Tunnel Tab on the connections manager: This is the 'global URL' of the SHH server at the ISP. The ip will normally work fine,

...

  1. thisisanisp.com

...

  1. too. And maybe SSH is available via the internal name server too - then use something like

...

  1. sshserver.thisisanisp.com

...

  1. .

Do I need PHP to use SQLyog with MySQL?

No!.

You won't do not need PHP or any PHP-based tool like phpMyAdmin. All you need is MySQL and SQLyog. But of course if you want to use your MySQL database with a website you must use a scripting language (PHP, ASP or JSP for instance)and the corresponding "preprocessor" must installed with the web(HTTP-)server. That is because a webserver without such extension is not able to connect to MySQL and interpret data from a database.

...

Even if the TCP-port (3306) normally used by the MySQL server is blocked (as often is the case at ISP's) SQLyog still let you connect using HTTP(s)-tunneling or SSH-tunneling.

SQLyog gives you the most options for connecting to MySQL

...

Even if the TCP-port (3306) normally used by the MySQL server is blocked (as often is the case at ISP's) SQLyog still let you connect using HTTP(s)-tunneling or SSH-tunneling. And if you are behind a proxy SQLyog can handle that too.

...

Starting from SQLyog version 5.15 we have improved the error message handling in relation to SSH-tunnel. The most common error messages now are:

SSH - related:

"FATAL ERROR: Unable to authenticate". Occurs in case of a SSH Username/Password Mismatch or in case that you are using a username or a host IP which is listed in “DenyUsers” in the SSHD configuration file (/etc/ssh/sshd_config on most systems).

"FATAL ERROR: Network ERROR: connection timeout". Network TimeOut (as it says) or simply could not establish contact to a SSH daemon on the URL specified. You even get this if the computer you are trying to contact is not available at all or offline. Also this error happens if you are using public/private key authentication and the keys are not valid. Keys used by SQLyog must be in .ppk -format (same as used by the 'Putty' program).

"FATAL ERROR: Network ERROR: connection refused". Occurs typically in case of wrong SSH port. (Note that the term 'refused' implies an active refusal from the server!)

...

Also see the note to the MySQL client error 2013 "Lost connection ..." below!

MySQL - related:


As a result of this improvement we can now also retrieve more meaningful MySQL server and client errors than before - for instance:

  • If MySQL user/pw is wrong result is MySQL server error 1045: "Access denied ..." as with any type of connection.
  • If MySQL port is wrong result is MySQL client error 2013 "Lost connection ...".
    Note that this error also occurs if port forwarding is disabled in SSH configuration (the configuration parameter 'AllowTcpForwarding' is set to 'no' in the 'sshd_config' file). It (here) simply tells that there is no connection from SSH to MySQL for some reason. But the mySQL client API 'thinks' there was one connection and that is why is says 'Lost connection ...' and not 'Can’t connect...'. There was one successful connection - but not to the MySQL server - to the SSH daemon only! But the MySQL client API is not designed to 'see' the difference!
  • If MySQL port is empty or ZERO however result is MySQL client error 2003 "Can’t connect to mysql server ..."
  • If MySQL host is wrong (or cannot be reached from SSH for some reason) result is MySQL client error 2005 "Unknown MySQL server..."

Unspecified error:

And this one is displayed if SSH connection cannot be established for some other reason and it has not been possible to resolve the error to one of the above.
"Could not establish SSH connection.
Make sure that the SSH server is running and you are entering correct values for SSH port forwarding."
A concluding note on the popular 'Putty' program and SQLyog SSH-tunneling.

...

The Acronym SSH stands for Secure Shell Host. SSH was originally created to provide a secure way to access server systems at "low level", to be used instead of common (but insecure) telnet methods. SSH can use several different forms of encryption, anywhere from 56 to 1024 bit. SSH has been ported to Operating Systems on several platforms including Linux, Microsoft Windows and Macintosh. There are SSH servers and SSH clients available for different types of communication.

You can find more information about SSH at https://en.wikipedia.org/wiki/OpenSSH/. Here you may notice this: "OpenSSH includes the ability to forward remote TCP ports over a secure tunnel, allowing that way arbitrary TCP ports on the server side and on the client side to be connected through an SSH tunnel". This is excatly what we make use of.

The term "SSH tunneling" in relation to a database server means that in- and outgoing communications to the network that hosts the database server "passes through" the SSH-server and uses the communications port (usually port 22) and the protocol of the SSH-server. The SSH-server then "translates" and "transfers" that in-and outgoing communication to the database server. SSH is actually quite simple to use. However if you are totally unfamiliar with networking terminology you will have to study it somewhat. Actually you may even install an SSH server at your own local machine and use it for connecting to a local MySQL server. Not much use of that, but it will give you an excellent understanding of what SSH is!

There is a built-in SSH-client in SQLyog that lets you connect to a MySQL server using SSH.

Basically there are two benefits of SSH Tunneling:
* SSH can be used to encrypt communications between SQLyog and your remote MySQL server.
* It lets you access the MySQL server even if the MySQL port (3306) is blocked.

Unlike HTTP-tunneling, you can't cannot take it for granted that SSH-tunneling is available at your webhost. In general the "more professional" and "more expensive" hosting providers offer SSH and the cheaper ones don't.

Refer to the SQLyog help file for instructions how to set up the SQLyog Connections Manager, if you want to use SSH-tunneling with SQLyog. Each SSH-connection occupies a TCP-port at your local machine. With recent SQLyog versions this port is picked automatically from the pool of high-numbered ports not already in use.

...

Sometimes when people are having problems with SSH-connections, we often hear "I can connect with Putty without problems". Maybe so, but it does not tell very much (almost nothing actually!) because the type of connection with Putty or a similar program referred to here by users is not tunneling and does not make use of port forwarding. Putty creates a remote (and secure) shell on the client machine, and connects to the 'mysql' client program on the server. So here the MySQL client is the 'mysql' client on the remote server. It is true that Putty can be used for setting up a SSH-tunnel as well, but this is not the simple 'connect with Putty' most often referred to and compared with here. With (SQLyog) SSH-tunnel the MySQL client is the client API that is compiled into SQLyog (and SJA). That is why port forwarding is needed and must be functional with SQLyog SSH-tunneling!

You can review the

Newtab2
aliasSSH-related error messages
urlhttp://wiki.idera.com/x/vAAnBg
.

Anchor
connectionissues
connectionissues
Connection Issues

...

Expand
titleError Nº 2003

Error no. 2003: Can't connect...

The error message: Error No. 2003: Can't connect to MySQL server on 'localhost' (or some other host)

Simply means that connection is not possible for one of the following (or similar) reasons:

  • There is no MySQL server running at the specified host
  • Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
  • Some networking issue prevents connection. It could be a network malconfiguration or a firewall issue. We have experienced sometimes that some firewalls (ZoneAlarm in particular) is blocking TCP-IP connections even if it claims to be disabled. Most often it will help to uninstall and reinstall the firewall.
  • When trying to connect to a MySQL server at an ISP this error message often indicates that direct connection to MySQL has been blocked. You must then use HTTP-tunneling or SSH-tunneling to connect.
  • Also this FAQ may have relevant information. It describes some more special situations when connection to MySQL on Linux.
Scroll pdf ignore

IDERA Website | Products | Buy | Support | Community | About Us | Resources | Legal