简体   繁体   中英

How to connect to MySQL Workbench?

I've bought a server from CloudAtCost.com and all the information it gives me about my server is Server ID, IP Address, Netmask, and Gateway. I can SSH in just fine, but I can't get MySQL Workbench to connect to it. I've tried both Standard (TCP/IP) and Standard TCP/IP Over SSH.

I figured it out. I was using "user" as my username when I needed to use "root".

MySQL server needs to be running.

Network connections need to be enabled.

You need to know what port MySQL is running on (default is 3306).

If reverse DNS lookup has not been disabled, MySQL has to be able to resolve IP address to hostname.

MySQL User has to be created and assigned a password, a username and host, host is either the specific host connecting or (less secure) a '%' wildcard for host. If DNS lookups are disabled, host will be an IP address.

Connections to the MySQL port (by default it's 3306) may be "blocked" by firewall...

There are a lot of possible reasons.


When we can't connect, there's usually a MySQL error message that indicates the kind of problem encountered.


But, my preference would be to only allow IP connections from 127.0.0.1. (We always turn off reverse dns lookups on our MySQL servers.)

I'd use ssh port forwarding (tunneling). Choose a port to use on your local machine, eg 13306, and configure SSH to "forward" connections to that port through the ssh connection...

You can configure that in the .ssh/config for the specific remote server, eg

Host remoteserver
  LocalForward 13306 localhost:3306

You'd need to first ssh to the remoteserver, and keep that session open.

Then on your local machine, MySQL Workbench would connect to localhost port 13306 . On the MySQL server side, that will be seen as coming from IP address 127.0.0.1,

Obviously, you'd need to have a user created, eg

GRANT USAGE ON *.* TO myusername@'127.0.0.1' IDENTIFIED BY 'mypassword'

And grant appropriate privileges.

转到Mysql Workbench>服务器状态>记下端口号,并将主机名指定为localhost:您的端口号,通常是3306

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM