How to connect MySQL workbench to database

4.3k views Asked by At

I'm trying to use mysql workbench to get access the database in my office. My friend has already helped me setup the connection in PuTTY, so I can write my MySQL script in that "black and white" window. However when I try to use MySQL workbench to get connection to the database, it causes error. It says:

  Failed to Connect to MySQL at 127.0.0.1:3306 with user martin (I tried root as well)
  Can't connect to MySQL server on '127.0.0.1' (10061)

I know there are a lot of questions and answers about this on stackoverflow. I tried some of them but without any luck.

I'm thinking do I need something called mysqld.exe in a certain directory? I have downloaded the file but when I double click it nothing happens. Do I need to run that as an administrator? One of my friends told me I don't need that at all. So what should I do now?

Any clue please enlighten me. Thanks heaps!!

2

There are 2 answers

2
Leandro Papasidero On BEST ANSWER

To connect to your MySQL database with Workbench software you should do the following:

Open your Workbench application >> Database >> Connect to database. Setup window will show up, please fill out the fields as follows:

SSH Section

  • Connection Method: Standard TCP/IP over SSH
  • SSH Hostname: OFFICE-SERVER-IP
  • SSH Username: SSH-USERNAME-HERE
  • SSH Password: SSH-PASSWORD-HERE

Mysql Section

  • MySQL Hostname: 127.0.0.1
  • MySQL Server Port: 3306
  • Username: MYSQL-USERNAME-HERE
  • Password: MYSQL-PASSWORD-HERE

Just For Ilustration purposes your configuration should look something like this:

enter image description here

0
Marc Ram On

Seems like you are trying to access the Mysql server running on your local machine in your example. The MySQL at 127.0.0.1 means connect to a mysql server running on the local machine.

If you are on the same network as the server and your Mysql server is set up to allow access from a second machine you need to enter the ip address of the machine that the Mysql server is running on for instance 192.168.1.210:3360 means connect to the machine at Ip address 192.168.1.210 using the default Mysql Port of 3360. Your Putty setup should have the ip address of the machine you need to connect to.