Can't connect to MySQL DB remotely - mysql

I keep trying to connect to my MySQL Database use POPSQL, and I keep getting the error code ECONNREFUSED (Error Connection Refused) M.Y.I.P:3306, and I can't figure out why. The set up is a follows:
I'm running Plesk, on Cent OS, which uses a MySQL DB (Maria), which I normally connect to using PHPMyAdmin using the Plesk interface.
Now I'm trying to connect to it using this POPSQL, but I've not been able to connect remotely using any applications.
My troubleshooting:
1: Restart Server: Many times, and after each change.
2: Check firewall: It's enabled, running, and port 3306 is open (I also tried connecting over SSH, which I can do in a terminal, but not POPSQL or any other SQL Connection software)
3: Check Plesk Config: Credentials are right, remote connections are allowed through any host Plesk DB config
4: Check Maria config, bind address is 0.0.0.0 instead of 127.0.0.1
[mysqld]
bind-address = 0.0.0.0
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
My knowledge of DB troubleshooting ends there, so if you have any ideas or recommendations as to whats going on and how to fix it please let me know. Again, I'm pretty new to all of this so I'm sure it's just a simple mistake, but an extra set of eyes would be extremely helpful.

I'm not good with firewalls and that shows.
I was editing the default firewall zone "public" instead of "plesk," the one controlling traffic for this server.
For future reference:
1: Check what zones are active.
firewall-cmd --get-active-zones
2: Edit the active zone
firewall-cmd --zone=plesk **OR whatever your zone is called** --add-port=3306/tcp --permanent
2.5: Make sure it says success
firewall-cmd --zone=plesk --add-port=3306/tcp --permanent
success
3: Reload firewall
firewall-cmd --reload
Credit to Bernd Buffen for pointing me in the right direction.
Don't forget the basics!

Related

Connect to Mysql remotely in centos 6.x server LAMP

despite I've tried everything suggested in the forum I still can't connect to MySQL remotely.
This is my my.cnf file:
[mysqld]
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I've tried also adding the line bind-address = 0.0.0.0 but still doesn't work.
Then I deleted it because I've preferred leave the default configuration of my webserver and because I've read that, if is not specified, it is 0.0.0.0 by default.
I have the port 3306 open as you can see from my webmin module:
Linux IPTables Firewall
I've created the MySQL account named 'michele' as you can see from my webimn module User Permissions
and also I granted to michele the permissions for any database Database Permissions
and granted to any host all permissions Host Permissions
To test my remote connection I'm trying to connect from MySQL for excel. that is the error error MySQL fro excel
It is impossible to stabilize the connection. Incorrect response of
the connected party after the time interval or no response from the
connected host MY-IP-SERVER:3306
Also I want to inform you that this is my second attempt to connect remotely. In my first I made it! For a problem that doesn't deal with the remote connection I needed to reinitialize my server and here I am.
The first time I remember that in some configuration file I've put # for comment some line but I don't remember which and if it deal with my problem. Please help me I'm going to be mad!
Michele
I made it!
The problem was for the ipTable rule:
REJECT reject with icmp-host-prohibited
rule
so for solve the problem I deleted it.
on my server shell with root permission:
# sudo iptables -L --line-numbers
find the id rule
and then deleted it:
# sudo iptables -D INPUT 10

Permission denied only with Workbench

I have a database located on a server and it is working correctly. I can access it from the local server and using phpmyadmin from any server connected to the network.
I would want to use Workbench in order to use its functions but I have tried a lot of possibilities and I'm not able to connect from it.
I have found a lot of solutions but anyone could not help me. For this reason, I'm trying to find someone who can help me with this.
First of all, I want to explain that this database is accessible from phpmyadmin (as I said before) and from webserver (I use database in my web application) so, the trouble of denied remote access is discarded. (with user root)
Furthermore I have looking for the problem and in the log of database server I have could find this:
error: connect to 127.0.0.1 port 3306 failed: Permission denied
channel_by_id: 0: bad id
I have tried to use Workbench with TCP/IP with the IP of the database server by port 3306 and with SSH connecting to webserver (this step is running correctly) and connecting to database with local IP and port 3306.
Furthermore, I have checked if port 3306 was closed and it is opened.
The config (my.cnf) is this:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
max_allowed_packet=1024M
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I know that this config is not usual but I have not installed it and I would not want to touch a lot because it is working now and a lot of people is using it.
I have tried too to edit hosts.allow adding the line mysqld: all but it did not work.
What can be the problem? Thanks for your help.
(I have checked Stackoverflow's posts too and I have not been able to find a solution)
you need to configure your mysql to allow remote login. then you can either specified your ip or wildcard * to allow all ip to access the mysql database.
this is the command to grant remote access.
Log in to the database server.
Connect to the MySQL database as the root user.
Enter the following command:
GRANT ALL ON <local database name>.* TO <remote web node username>#<remote web node server ip address> IDENTIFIED BY '<database user password>';
For example,
GRANT ALL ON magento_remote.* TO dbuser#192.0.2.50 IDENTIFIED BY 'dbuserpassword';

Allowing Remote Access on my Xampp MySQL DB

Okay I apologize in advance if this seems to be a trivial question but I am new to databases and such so here's my problem.
I have installed xampp and using their MySQL database service. I also able to connect to my database remotely in my network yet I would like to access the database that i have created from another computer out side my LAN. So far i have created a user named "Lester" with all privileges enabled and the host set to "%". In the config file i have it set as follows
# The MySQL server
[mysqld]
user=mysql
port=3308
socket =/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
key_buffer=16M
max_allowed_packet=1M
table_open_cache=64
sort_buffer_size=512K
net_buffer_length=8K
read_buffer_size=256K
read_rnd_buffer_size=512K
myisam_sort_buffer_size=8M
bind-address = 0.0.0.0
How do i go about connecting outside of my network..
Please specify your ip address in the bind address
bind-address=192.168.1.100
Try and let me know if you are facing any problems.
Goto
http://localhost/phpmyadmin -> user accounts -> Edit privileges -> change login information
change Host drop down to Any host
then restart mysql
reference Link
https://www.hacking-tutorial.com/tips-and-trick/how-to-make-xampp-mysql-database-accessible-by-network/#sthash.11j7Xjht.dpbs

Using a different external port for mariadb on Centos7

I'm trying to allow remote access to a single mysql database on a different port.
I have added the user and granted all privileges from % to the specific database.
I've added the external bind address and commented out skip-networking from /etc/my.cnf
I've flushed privileges on mysql (technicall mariadb)
And I've setup the port forwarding in firewalld using
firewall-cmd --permanent --zone=external --add-masquerade
firewall-cmd --permanent --zone=external --add-forward-port=port=53306:proto=tcp:toport=3306
I've reloaded firewalld.
I'm testing using dbforge studio but I'm still not able to connect remotely.
What am I missing?
Assuming that SELinux is enabled:
you certainly need to configure port labelling on port 53306 (see http://www.certdepot.net/rhel7-use-selinux-port-labelling/).
you also need to check if a particular SELinux boolean has to be set (see http://www.certdepot.net/selinux-diagnose-policy-violations/).
Regards.

Mysql access remotely

I have deployed one django application on live IP adress Backend is Mysql running on the same IP.
There is pythoncard(GUI) application installed on some another DNS/Gateway.
I am getting 2003 can't connect mysql server on ...242* while executing.
Grant all and everything done but it is raising the same error. How do I connect to that host through internet or static IP.
HOw to resolve it? Mysql level or application level
Thank you
This is my.conf
[client]
port=3306
[mysql]
default-character-set=latin1
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
bind-address = 110.243.143.*** # SERVER IPADDRESS
# skip-networking
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files (x86)/MySQL/MySQL Server 5.5/"
Make sure MySQL is listening on your public IP. You can set this in my.cnf. The property you are looking for is bind-address.
Next, make sure your user is authorized to connect from a remote IP. You can adjust the permissions using the GRANT statement.