Problem with remote connection to MySQL database (Error 1045) - mysql

I installed MySQL Server 8.0 on Windows Server 2019, during installation I created user 'superna' # ' %' with DBAdmin rights. When connecting from a local machine, there are no problems (mysql -u superna -p), but when trying to connect from a remote machine (mysql -h 10.165.1.20 -u superna -p), error 1045 is returned.
I checked the availability of port 3306 using nmap, port is open.
When installing mysql server on Windows 10, such problems are not observed, the connection from the remote machine works correctly. Can you tell me what point in the settings I might be missing?

Can you confirm if your my.cnf file have this line? If it hasn't, add it and restart mysql.
bind-address = 0.0.0.0

Problem solved. The server was configured to NAT port 3306 to another machine on the network.

Related

Unable to Access MySql 8.0 Database from Remote Windows Server

I have Installed MySql 8.0 Version in a windows
server and able to connect via WorkBench/MySql shell locally.
I would like to access MySql from a remote windows server.
Here are the things I have tried.
1) Created root#% user and Grant full access to the new user.
2) Created a new user as test#'remoteserveripaddress' and Grant full access to the user.
3) Opened port 3306 on Both Remote and MySql server.
4) Added "bind_address=*" in my.ini file and restarted the MySQL80 Service.
I am running out of options.
Error: I am getting below error
Failed to connect MySql at UserName#hostipaddress:3306
SSL connection error: error:00000000:lib(0):func(0):reason(0)
No matter how many different ways I try.
Not sure what am I doing wrong ??
Try to execute below command in your terminal :
mysql -h server -P 3306 -u root -p
If you successfully connect to your database, the same thing has to happen with Mysql Workbench.
If you are unable to connect then I think 3306 port is acquired by another process.
Find which process running on 3306 port. If required, give admin privileges using sudo.
netstat -lnp | grep 3306
Kill/stop that process and restart your MySQL server. You are good to go.
Execute the below command to find my.cnf file.
mysql --help | grep cnf
You can change MySQL port to any available port in your system. But after that, make sure you restart MySQL server.

mariadb remote connection fail in centos

I have visited many websites for remote connection of MariaDb.
I have executed the command as below to create user with password in sql.
GRANT ALL PRIVILEGES ON . TO 'root#(my server ip)' IDENTIFIED BY '(my password)'
And i've added one line below [mysqld] in the file of /etc/my.cnf.d
bind-address = 0.0.0.0
Then restart MariaDb service as below
sudo systemctl restart mariadb
Everything runs good.
However when i access by below command, it runs failed.
mysql -u root -p -h (my server ip)
I've turn off my firewall in my server, and turn on the port 3306 in GCP server, and it can be expected, i must fail to connect in my local machine.
Since you want to use a TCP connection, I assume that you want to connect to a remote server, not to a server running on the same machine.
Make sure that you are able to connect physically to the database server, e.g. with telnet server_ip:3306.
Determine the IP address of the computer from which you want to connect to the server (= client_ip).
Add a user on the server:
GRANT ... TO root#client_ip
If client and server are running on the same machine, the preferred way is to use a linux socket (user#localhost) which is way faster.

I cant access my mysql server hosted on azure from remote

Good evening all, i have set up an azure server with ubuntu server and have installed MySQL with some python code I need to run , I have turned off the firewall on Ubuntu and setup port forward on azure and i still can not connect to MySQL from my pc using workbench, I installed PHPMyAdmin as well and I was not able to connect to that either, I am not sure what else I can try, I have started setting up a new server on a local pc but I would it on the cloud
I created a Linux (ubuntu 18.04) VM ,set up a mysql on it and access it on my local successfully. This is my steps below :
1.Enable 3306 port on Azure portal :
2.Connect to Azure VM , and run command below to install mysql :
sudo -i
apt install mysql-server
3.After your mysql is installed , modify “bind-address” directive in /etc/mysql/mysql.conf.d/mysqld.cnf , modify 127.0.0.1 to 0.0.0.0 to make sure your mysql server will listening on all your VM's ips :
vim /etc/mysql/mysql.conf.d/mysqld.cnf
save your modify and restart your mysql server :
systemctl restart mysql
This time , can ping 3306 port of my vm successfully :
If your mysql server is running on your VM successfully , but you can not ping it,if the error info is timeout , pls check your firewall settings , if the error info is remote server refused your request , this means there is no service listening on 3306 port.
4.Create a user on mysql so that we can use this account connect to mysql from local:
CREATE USER 'stan'#'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'stan'#'%' WITH GRANT OPTION;
Well , try to connect to mysql from local using navicat :
Connect to mysql on Azure Linux VM from local successfully :
Hope it helps .

Can't connect to remote MySQL server on Windows

I'm trying to set up a MySQL server on Windows that will allow another computer to connect to it remotely. The client computer is getting a 'Can't connect to MySQL server' error in MySQL Workbench.
Both computers are on the same network, and the server is using a static IP address (I have forwarded ports in my router to allow external connections to the public IP address).
What I've tried (suggested by other threads):
In my.ini, setting bind-address = 0.0.0.0 / commenting out bind-address / commenting out skip-networking
Running GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';. When I run this, I get the error Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in a future release; however I can confirm that in Workbench, the user's privileges are all checked (under the 'Users and Privileges' screen).
In my router settings, forwarded port 3306 on the server's static IP address
Disabling the Windows Firewall on the server.
Verified that the MySQL Server Windows Service is running.
Can anyone advise?
Ref: Try connecting with mysql cli instead of work bench from the remote machine, so u can isolate that cli client u r able to access the remote DB. because the following reason might be causing connectivity issue in Workbench.
mysql cli cmd
install mysql.exe client program
from cmd prompt> mysql -hhostname -uusername -ppass dbname
Cannot connect to Database server (mysql workbench)
In MySQL Workbench (5.2.47 CE)
click Mange Server Instances (bottom right corner)
click Connection
in the Connection box select:
Local Instance ($ServerName) - root#127.0.0.1:3306 '<'Standard(TCP/IP)>
click Edit Selected...
under Parameters, Hostname change localhost or 127.0.0.1 to your NetBIOS name
click Test Connection

Trouble Creating a connection in MySQL Workbench

I am using Fedora 18 and recently installed MySQL workbench.
I created a new connection in MySQL workbench, but when trying to open I get the following error:
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
Can't connect to MySQL server on '127.0.0.1' (111)
Please:
Check that mysql is running on server 127.0.0.1
Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from
Any idea what the issue would be?
Fedora 18 is a Linux Based Operating System and it works on chmod 777. so there should be authentication problem. otherwise server 127.0.0.1 and host name , username same as we keep in windows. you need to set authentication.