KzKrew
asked on
Connect to remote MySql Database using MySql Workbench
Team Experts
I am trying to connect to a remote legacy MySql Database that resides on a Windows 7 32Bit machine.
Legacy system is 10+ year old.
Have no idea how the database was setup but have been able to connect locally using
mysql -h 192.168.x.x -P 3306 -u root -p
Have run the following commands
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Then restarted MySql
Have shut off the Firewall
When I try to connect using MySql Workbench I get a
Failed to Connect to MySql at 192.168.x.x:3306 with user root
Access denied for user root@192.168.x.x (using password:YES)
Let me know if you have any thoughts on how to connect
Dan
I am trying to connect to a remote legacy MySql Database that resides on a Windows 7 32Bit machine.
Legacy system is 10+ year old.
Have no idea how the database was setup but have been able to connect locally using
mysql -h 192.168.x.x -P 3306 -u root -p
Have run the following commands
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Then restarted MySql
Have shut off the Firewall
When I try to connect using MySql Workbench I get a
Failed to Connect to MySql at 192.168.x.x:3306 with user root
Access denied for user root@192.168.x.x (using password:YES)
Let me know if you have any thoughts on how to connect
Dan
ASKER
Yujin Boby --MySql server is on Windows 7 machine
Was able to pull this info logging in locally
mysql> status;
mysql Ver 14.14 Distrib 5.5.12, for Win32 (x86)
Connection id: 140
Current database:
Current user: root@ls2
SSL: Not in use
Using delimiter: ;
Server version: 5.5.12 MySQL Community Server (GPL)
Protocol version: 10
Connection: 192.168.1.52 via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
TCP port: 3306
Uptime: 3 hours 36 min 59 sec
Threads: 1 Questions: 5150 Slow queries: 0 Opens: 169 Flush tables: 1 Open tables: 0 Queries per second avg: 0.
--------------
mysql>
When i try to telnet using Putty -- get a Network error: connection refused error
Was able to pull this info logging in locally
mysql> status;
mysql Ver 14.14 Distrib 5.5.12, for Win32 (x86)
Connection id: 140
Current database:
Current user: root@ls2
SSL: Not in use
Using delimiter: ;
Server version: 5.5.12 MySQL Community Server (GPL)
Protocol version: 10
Connection: 192.168.1.52 via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
TCP port: 3306
Uptime: 3 hours 36 min 59 sec
Threads: 1 Questions: 5150 Slow queries: 0 Opens: 169 Flush tables: 1 Open tables: 0 Queries per second avg: 0.
--------------
mysql>
When i try to telnet using Putty -- get a Network error: connection refused error
MySQL blocks remote access on the 'root' account. You need to create another account for remote access.
When i try to telnet using Putty -- get a Network error: connection refused error
Can you try telnet command from command line ? If you don't have telnet installed, you can install it on windows with following command (run as Administrator)
dism /online /Enable-Feature /FeatureName:TelnetClient
ASKER
Ok -- have made new user -- granted that user permissions
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
FLUSH PRIVILEGES;
Then ran telnet command from telnet window. For some reason getting invalid command
Microsoft Telnet> telnet 192.168.1.52 3306
Invalid Command. type ?/help for help
Microsoft Telnet>
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
FLUSH PRIVILEGES;
Then ran telnet command from telnet window. For some reason getting invalid command
Microsoft Telnet> telnet 192.168.1.52 3306
Invalid Command. type ?/help for help
Microsoft Telnet>
You can not telnet to a MySQL server. MySQL requires a driver that understands the correct protocol and telnet does not. Also, you did not create a user with remote access privileges. This is in addition to the same user at localhost. You need both. Should look like this:
CREATE USER 'user'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'%';
FLUSH PRIVILEGES;
See '%' on this page: https://dev.mysql.com/doc/refman/5.6/en/account-names.html
Telnet is only to test connectivity to the server on that port. It doesn't do anything with MySQL.
You are already running telnet thus the "Microsoft Telnet>" prompt.
The correct command then is: open 192.168.1.52 3306
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/telnet-open
>>When i try to telnet using Putty -- get a Network error: connection refused error
This means the server doesn't have anything listening on that server and port to accept connections. This means that MySQL isn't accepting connections on that server and port.
I'm not a MySQL Expert which is why I haven't posted until now but it appears you need to configure MySQL to "listen" for connections coming in from the outside.
A quick Google provided this but I cannot confirm if it still relevant:
https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql
Microsoft Telnet> telnet 192.168.1.52 3306
Invalid Command. type ?/help for help
You are already running telnet thus the "Microsoft Telnet>" prompt.
The correct command then is: open 192.168.1.52 3306
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/telnet-open
>>When i try to telnet using Putty -- get a Network error: connection refused error
This means the server doesn't have anything listening on that server and port to accept connections. This means that MySQL isn't accepting connections on that server and port.
I'm not a MySQL Expert which is why I haven't posted until now but it appears you need to configure MySQL to "listen" for connections coming in from the outside.
A quick Google provided this but I cannot confirm if it still relevant:
https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql
@Dan Kuzdas
Run telnet command from Command promt.
Run telnet command from Command promt.
ASKER
Thanks All -- will give this a try
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Hi Dan,
Do you need more help with this?
Regards,
Tomas Helgi
Do you need more help with this?
Regards,
Tomas Helgi
run this on mysql server
Open in new window
See if mysql port accessable from your client machine.
Open in new window
This need to be run on computer that runs MySql Workbench. If you can connect, you will see MySQL prompt.