Passenger not reaching MySql - mysql

I have Nginx+Passenger+Rails3.
Passenger throws the following error:
Can't connect to MySQL server on '184.169.131.xxx' (111) (Mysql2::Error)
I am able to connect to MySql using mysql command. I think that the user that is running Passenger doesnt have the permissions.
I want to know: How to determine which user is running passenger and how to give permissions to access mysql.
Thanks

If it can't connect, it's likely that either:
Your MySQL process is bound to 127.0.0.1 and can't accept connections from remote machines.
Your firewall has blocked port 3306.
Are you certain that mysql is connecting to the same remote? You might be running a local server instead that allows access with the default configuration.
As a note, opening up 3306 to the general internet is a bad idea, so you will want to be very selective in how you do this. The best practice is to use private IPs whenever possible, like 10.x.x.x, 172.16.x.x or 192.168.x.x. There are a number of reserved blocks which can be used safely, but these cannot be routed outside your local network.
You should also check that whatever config/database.yml settings you have defined are the same you're using with the mysql command-line tool. Passenger is not treated as a special case.

Related

MySQL ODBC Driver - Is there a way to block an access of MySQL Connector ODBC Driver?

Good afternoon, i have 2 PC's, where one is my WAMP server, with MySQL Database and so on. And the other i made a connection to my DB throw MySQL Connector ODBC Driver.
My doubt is if is there a way to block access of this second PC to my Server PC ?
I'm learning about MySQL control management, and i came across with this case, and i couldn't found an answer searching about this by myself.
No, there's no builtin mechanism in MySQL Server that detects that a connection attempt is from a MySQL Connector ODBC Driver, and blocks the connection.
It is possible to block connections to the MySQL Server, by setting up the appropriate user definitions in MySQL Server (entries in the mysql.user table).
In MySQL, a user is identified by a user name together with a host (either a DNS hostname or IP address, depending on whether we've specified skip-name-resolve option.)
If we setup MySQL users with wildcard hostname '%', then we are allowing TCP/IP connections from any host or any IP address.
If we remove user entries with a wildcard hostname, and instead create users with a more specific hostname (or IP address), then connections will be allowed only from the specified host/IP address. With a net effect of blocking connections from other hosts.
This topic is more fully addressed in the MySQL Reference Manual
https://dev.mysql.com/doc/refman/5.7/en/connection-access.html
Also, for TCP/IP connection attempts, a network firewall (for example, Iptables on Linux) can be configured to knock down connections before they are even seen by MySQL Server.

How to fix 'Can not connect to MySQL server' error?

First of all I apologize for my English is not perfect.
I'm trying to connect to mysql database remotely.
I have already done the basic steps such as, for example, comment the bind address in my.cnf.
I gave permissions to the appropriate users in MySQL.
I tried with my friend to do it connect to the database, and it worked but we were in the same room with the same router.
Now I'm home and I tried to connect my friend, but I always get error:
ERROR 2003 (HY000): Can not connect to MySQL server ....
Maybe it's a problem of my home router? I can not even do the telnet.
P.S. I've also taken steps to set the firewall.
Some reasons for that,
mysqld is not running on the local host. Check your operating
system's process list to ensure the mysqld process is present.
You're running a MySQL server on Windows with many TCP/IP connections
to it. If you're experiencing that quite often your clients get that
error, you can find a workaround here: Section B.5.2.2.1, “Connection
to MySQL Server Failing on Windows”.
Check whether the server is running on that host by executing telnet
some_host 3306 and pressing the Enter key a couple of times. (3306 is
the default MySQL port number. Change the value if your server is
listening to a different port.) If there is a MySQL server running
and listening to the port, you should get a response that includes
the server's version number. If you get an error such as telnet:
Unable to connect to remote host: Connection refused, then there is
no server running on the given port.
Look at this mySQL full documentation, it will be helpful.

Can't Connect to MySQL instance Remotely that is running on EC2 Instance (Not RDS)

I have seen a lot of posts that claim they are running an RDS instance of MySql in which they cannot connect to, but I am not running RDS.
I used my EC2 insance to host my wordpress blog which was installed using the Web Platform Installer.
This setup the wordpress schema and data that I needed and I have been running it for a couple years.
I want to be able to access this database remotely instead of only logging into my server.
I have checked and have the following users
root
wpadmin
I have also verified that the port specified in the mysql config is the standard 3306 and I have setup an Inbound Firewall rule to allow 3306 through.
When I try to connect from MySql Workbench, I get the following error message:
Number 3 Is particularly one that I do not know how to check, but I do know that MySql is running and that it is running on 3306. Additionally, I know I am using the correct password.
When I try to connect, the prompt looks like this. Do I need to do something to grant Mysql user permissions or anything?
Based on your GRANT information, you have at least the problem of root user only having access privileges from localhost. You would need to create a root#% user (or a more specific host/IP instead of % if you have a reliable address). That would allow external access so long as your EC2 security group also allow access on port 3306 (either globally or to a more restrictive IP address or IP range).
Of course the security implication here is that you are opening up access to MySQL that you might not want to make more accessbile to potential attackers. For this reason, I would recommend you access your DB via SSH tunnel, which is supported by MySQL workbench. This will in essence allow you to shell into the host your your access key and then access as root#localhost.

Unable to connect to MYSQL on a remote computer

I am working on windows and having a remote desktop connection of another machine. I am trying to connect to the mysql running on the remote machine through my MySql workbench, installed on my machine.
When I specify the details to connect to mysql i.e.
IP- a.b.c.d
port-3306
username=root
password=
But everytime it shows me an error saying-
Your connection attempt to connect to user='root'failed from your host to server at a.b.c.d:3306
Is it possible that I can connect to mysql on a different machine?
Certainly that is possible, mysql is a network transparent service. However obviously the normal access authorization rules apply.
do you have network access to the mysql port, this might be blocked by a firewall. You can check that by using telnet ip-address-of-server 3306. Does the server answer or do you get a timeout or are blocked? (the answer would look cryptic, soomething like 5.5.33-MariaDB[*[n7p~g!�iXccI$r9``Y{$mysql_native_password or similar )
the mysql server can be configured to not listen to remote connections. This can add security to the setup, but would obviously block any remote connection attempts. You will have to check the configuration files of mysql for that.
mysql itself implements an authorization level. So check if that 'root' user actually is allowed to connect from the outside. Those authorizations are stored in the internal "mysql" database.
Also it is not clear from the question what your network topology is: is the mysql server running on that system you have a "remote connection" to? Is the mysql-workbench running on that remote system or on your local system? This might affect the ip address you have to use inside the workbench.

Error No. 2003. Can't connect to mysql server

I has had two days searching and exploring solutions regarding the error 2003.
Can't connect to mysql server on 'Server name'.
The firewall is off and I had added the port 3306, the one that mysql uses.
Any recommendation?
Please refer this FAQ which describes how to solve this issue: http://faq.webyog.com/content/23/15/en/error-no-2003-can_t-connect.html
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.
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.
It worked for me.controll pannel->administrative tools->services->mysql and start mysql.Some times simple solution saves lot of time.
normally means that there is no MySQL server running on the system .
check your server running
this could be due to firewalls of the system try below command and check
service iptables stop
i have the same issue but i fix it.
my hostname is DEBIAN, i just modify the file my.cnf ( for mysql) and set bindaddress : 0.0.0.0
this option say to mysql to listen all interfaces. restart your server and finish
if your question refer to can't connect to mysql on hosting (cpanel), i also had same problem.
I also turn off firewall, but it doesn't solve my problem.
Rather than using server name or domain name on Mysql Host Address, i using ip address given by hosting provider.
And it works.
Going to services and starting MYSQL service doesn't work for me.
Finally, I hit the following commands inside the MYSQL command-line client:
ALTER USER 'username'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
There is a high chance that you are making one of the two mistakes.
First :
You are inputting the wrong password. check your password or change it with
this command
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_password';
In place of 'very_strong_password' give a strong password of your choice.
Second:
You are using '#' in the password which can be confused with the other with #localhost.
The SQL Sever might not be installed.
Please refer this to install:
MySQL
The solution worked for me
Go to services and start MySql services
window: press the start button and search services. Then star MySql services