I'm pulling my hair over the following situation.
I'm unable to connect to my MySQL server in Vagrant (2.0.0 , OS: Ubuntu 16.04 ) with only specific applications (HeidiSQL and Talend 6.1).
This error happens with Talend MySQL components with the mysql-connector-java-5.1.30 jar and Java 1.8 JRE.
I receive the following error each time when connecting either directly (TCP/IP) or over SSH (TCP/IP over SSH) to the MySQL Server with the aforementionned applications:
Access denied for user 'user'#'IP' (using password: YES)
This however doesn't happens with MysqlWorkbench with both direct connection (TCP/IP) or over SSH with the same user credentials. Below are the settings of the MySQL server:
MySQL Server Network Info
Maria Db: 10.0.34
bind-address: 0.0.0.0
skip-name-resolve: true
The following have already been tried and tested:
Access credentials and privileges verification
DNS flush both on Guest and Host machines
Addition of MySQL server IP to host file
Verification of ports opening both on host and guest
The following solved the issue:
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'#'%' WITH **GRANT OPTION**;
The GRANT OPTION does the trick.
Alternatively this could be caused by wrong driver being used in your Talend workspace. To update the MySQL connector JAR follow the steps below:
Donwload the updated connector driver here
Replace the 'tMySQLOutput/tMySQLInput' component(s) with an equivalent tJDBC ones
Add the new connector JAR (No 2 on the image) and the class name com.mysql.jdbc.Driver (No 4 on the image) (ref https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-installing-classpath.html)
Related
I've currently set up a staging area for my app in Digital Ocean with LAMP stack. The Framework for my app is Laravel 5.5 and Vue 2x.
In development, I've been using remote MySQL and had no issues with the connection error. However, when I moved it to the staging env, it is giving me access denied error. When I looked at it closely to the error log, Access denied is for username#[digital-ocean-droplet-ip], whereas I have properly configured the MySQL credentials to the remote host IP under laravel's config/database file.
So, I am doubtful if I have to do any configuration under Apache to allow any external MySQL connection? I forgot the cmd but I did allow sfw firewall allow to any port 3306 to the remote server IP address in Apache.
Any help is appreciated.
Thanks!
MySQL by default does not create an user with access from remote connections.
First you need to create an user on database that allows connection from outside (%) or a specific IP
CREATE USER 'newuser'#'%' IDENTIFIED BY 'password';
Than give him privileges
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'%';
The *s could be replaced by your database and table name respectively
You might also check if in your mysql configuration(/etc/mysql/mysql.conf.d/mysqld.cnf in my case) has this line uncommented
bind-address = 127.0.0.1
Change the ip if necessary
restart mysql and apache
sudo service apache2 restart
sudo service mysql restart
Than update the user and password at your .env file and try again!
I've installed MySQL database server on Ubuntu Server 16.04 virtual machine. I've created a new database called Test:
CREATE DATABASE IF NOT EXISTS Test;
I also created new remote user 'test' and gave him privileges on that database:
CREATE USER 'test'#'10.17.6.144' IDENTIFIED BY 'test';
GRANT ALL PRIVILEGES ON 'Test'.* TO 'test'#10.17.6.144;
I tried to connect to MySQL database using DataGrip IDE, but failed numerous times. My virtual machine is visible on my local network. I can see its ip and MySQL server on nmap. I also changed
bind-address: 127.0.0.1 to bind-address: 10.17.6.144 in /etc/mysql/mysql.conf.d/mysqld.cnf. But I still get this message:
Connection to Test#10.17.6.144 failed.
[HY000][1130] null, message from server: "Host is not allowed to connect to this MySQL server"
I can't figure out what I'm doing wrong. Any ideas?
You need to add a grant for the ip address of your client system so that it will be able to connect to mysql.
I searched a lot but not able to solve that problem.
i am able to access MySQL server running on different windows machine. steps i have taken are
changing my.ini file bind address to 0.0.0.0
creating user and granting permission by GRANT ALL PRIVILEGES ON DATABASE.* TO user#'%' IDENTIFIED BY 'password';
from command line to windows MySQL server mysql -h windows server ip -u user -p
it works fine and from MySQL workbench i am able to connect for windows MySQL server from my machine. BUT when in Linux virtual machine i have done the same thing
changing my.cnf file and change bind address to 0.0.0.0.
creating user and granting permission by GRANT ALL PRIVILEGES ON DATABASE.* TO user#'%' IDENTIFIED BY 'password';
From command line to LINUX MySQL server mysql -h linux server ip -u user -p
but for that i am getting following error after giving password ERROR 2003 (HY000): Can't connect to MySQL server on 'linux server ip' (10060) also when connecting from c# by following connection string <add name="MySqlConnection" connectionString="Server=LINUX_VM_SERVER_IP;Database=database;Uid=user;Pwd=password" providerName="MySql.Data.MySqlClient" />
i am getting Error : Unable to find and specified mysql host
i have checked in LINUX_VM that 0.0.0.0:3306 is in listening status.
if i try to telnet LINUX_VM MYSQL Server service using />telnet
LINUX_VM_IP 3306 i got the ERROR : Connecting To
LINUX_VM_IP...Could not open connection to the host, on port 3306:
First, try to connect to the database on the VM hosting the database. If the connection is successful, then the configuration of the database is correct. Otherwise, please check the configuration of your database.
Second, if you are able to connect to database on the VM, then the most possible cause of this issue is firewall. Please check if the local firewall (iptables) allows inbound connection on port 3306. For test purpose, you may disable the firewall temporarily. Also, please check if the NSG has been configured properly to allow the inbound traffic on port 3306.
Besides, if the VNET has been associated with a NSG, then we need to allow the inbound traffic in the NSG too.
I am trying to install and test a MySQL ODBC Connector on my machine (Windows 7) to connect to a remote MySQL DB server, but, when I configure and test the connection, I keep getting the following error:
Connection Failed
[MySQL][ODBC 5.3(w) Driver]Access denied for user 'root'#'(my host)' (using password: YES):
The problem is, I can connect with MySQL Workbench (remotely - from my local machine to the remote server) just fine. I have read this FAQ extensively but it's not helping out. I have tried:
Checking if mysql is running on the server (it is. I even tried restarting it many times);
Checking if the port is listening for connection on the remote server. It is.
Connecting to the remote server using MySQL Workbench. It works.
Checking if the IP address and Ports of the remote database are correct;
Checking if the user (root) and password are correct;
Re-entering the password on the ODBC config window;
Checking and modifying the contents of the "my.conf" on the remote server to allow connections from all sides (0.0.0.0);
Including (my host) on the GRANT HOST tables from mySQL (I also tried the wildcard '%' but it's the same as nothing);
Running a FLUSH HOSTS; And FLUSH PRIVILEGES; command on the remote mySQL server to reset the privilege cache;
Turning off my Firewall during the configuration of the ODBC driver;
Checked if the MySQL variable 'skip_networking' is OFF in order to allow remote connections.
What is frustrating is that I can connect with MySQL Workbench on my local machine (with the same IP/user/password), just not with ODBC.
What could I be doing wrong, or what could be messing up my attempt to connect with ODBC?
Update: I managed to set up the ODBC driver and get it running correctly on the server side. I can connect there to the localhost using a command line (with the "isql" command). But I still can't connect over remotely with my Windows 7 machine.
Solved.
As it turns out, it was a permissions problem. I ran the following command on the remote server SQL:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'(my_host)' IDENTIFIED BY '(my_password)';
I had run the previous command, but without the "IDENTIFIED BY" password. Then, to reset the mysql permissions cache, I also ran
FLUSH PRIVILEGES;
And now it works.
Worked for me too only with 64bit odbc driver not for mySQL 32 bit.
We had a similar case that 'user'#'%' was granted at server but ODBC connect failed at a PC while workbench connect successfully.
MariaDB 10.0.31,
MySQL ODBC 3.51,
MySQL Workbench 8.0
Solved by install MariaDB Connector/ODBC 3.1 instead of the MySQL ODBC (https://downloads.mariadb.org/connector-odbc/).
MySQL error:
Failed to Connect to MySQL at 12.34.567.890:3306 with user jsdbadmin
Lost connection to MySQL server at 'reading initial communication packet', system error: 61
Using:
Plesk, SuSE vServer, fresh installation: completly new about an half year ago.
Software:
Trying to connect via MySQL Workbench, current version.
Hostname: 12.34.567.890 (modified for privacy), also tried with domain
Port: 3306
Username: My DB user name, as specified in Plesk when DB was created.
Password: *************
Default Schema: feeds
Tried TCP/IP, TC/IP over ssh.
Searched online:
These settings are not the problem:
#skip-networking
#bind-address = 127.0.0.1
Both already commented out.
Do you have a Firewall blocking the connection ?
You can test by telneting to the mysql port.
you also need to allow the ip/user combos that are allowed to connect
e.g.
to add a new user
GRANT ALL ON jsdbadmin.* TO remoteadmuser#'12.34.567.890' IDENTIFIED BY 'PASSWORD';
or
to grant access to a specific ip
update db set Host='12.34.567.890' where Db='yourdatabase';
update user set Host='12.34.567.890' where user='jsdbadmin';
Another possible (really annoying) error is that the server's public ssh keys have changed since your last login or that you've never logged in to that server using SSH and therefore you must manually approve them.
To solve this:
$ nano ~/.ssh/known_hosts
Remove old server keys from the file. Save & exit.
Connect to the server manually (ie. from terminal) and approve saving the new keys
After successful login from terminal, retry the mysql connection over ssh.
That worked for me...