Having trouble to connect to (remote) MySQL database with MySQLWorkbench - mysql

I'm using a Mac with macOS 10.11.6. I want to connect MySQLWorkbench 6.3.7 to a MySQL database stored on my Linux server. I'm able to create a connection with Sequel Pro but it doesn't work doing the same in MySQLWorkbench. This is what I am doing:
1. Open "Setup New Connection" window
2. Selecting "Standard TCP/IP over SSH"
3. SSH Hostname = my servers IP
4. SSH Username = same I use to login in MySQL database with PHPMyAdmin
5. SSH Password = same I use to login in MySQL database with PHPMyAdmin
6. SSH Key File = I do nothing here, stays empty
7. MySQL Hostname = my servers IP
8. MySQL Server Port = I do nothing here, stays empty
9. Username = same I use to login in MySQL database with PHPMyAdmin
10. Password = this is the password I also use to access my server with the FTP client
11. Default Schema = I do nothing here, stays empty
When clicking "Test Connection", I get:
Please enter password for the following service:
Service: Mysql#MY_IP:3306#MY_IP
User: MY_USERNAME
When I enter the password I get:
Failed to Connect to MySQL at MY_IP:3306 through SSH tunnel at MY_USERNAME#MY_IP with user MY_USERNAME
Can't connect to MySQL server on '127.0.0.1' (61)
What am I doing wrong? Can anybody help me please?
P.S. I replaced the IP and the username with MY_IP and MY_USERNAME.

First, make sure your remote server has ssh enabled on it.
Second, assuming it does have SSH enabled on it, usually the SSH username and the MySQL username will be different (for security reasons). Regardless, make sure you have the correct SSH username / password (and it sounds like you already have the correct MySQL username / password).
Third:
4. SSH Username = same I use to login in MySQL database with PHPMyAdmin
- See above
5. SSH Password = same I use to login in MySQL database with PHPMyAdmin
- See above
7. MySQL Hostname = my servers IP
- Usually the value for this is either localhost or 127.0.0.1 - try either of
those and see what happens.
On a personal note, I tried upgrading my version of MySQL Workbench (using OSX) and I had nothing but problems so I had to download a previous version. The only one that seems to work for me is here. If none of the suggestions I made above work for you, maybe try removing your current version and downloading an earlier version just to see if that's what's causing the problem or not.

Related

Connecting MySQL workbench to MS ODBC

I am trying to connect a MySQL server i have made in SQL workbench to ODBC so that i can access the data in excel.
I have checked that my server and instance are running, I have also allowed ODBC through my windows firewall.
I have tried entering 127.0.0.1, localhost and my full computer name as the TCP address however i still get a connection denied message.
However if i test the connection from within workbench it connects fine to the SQL Server.
Ok i found a way to make it work,
Navigate to "users and privileges" within SQL Workbench,
Select your username from the left (not root)
Then were it says "limit to host matching" change the "%" symbol to your local ip 127.0.0.1, Also change the root password.
Then enter these new details in ODBC and it should work.

How to access MySQL remotely through workbench

Hi I'm trying to create a new Connection to an MySQL database installed on a remote Windows server. However, due to server authentication problem, I cannot get the local mysql workbench connected to the remote database. And I could not find a place in workbench where I can provide my server authentication, i.e. username and password to access server. Does anyone know how to do this?
Thanks!
in the Home window of mysql workbench, near Mysql Connections there is a + button, click on it to Open the setup new Connection wizard, then you get to enter the server's parameters.
Hostname : your Windows Server's host name.
Port : Port on which the remote mysql server communicate.
Username : your Mysql server's Username.
Password : your Mysql server's Password.
Default Shcema : the database you want to connect to.
Hope this helps

Changing SSH Password which is routing through mysql

I have mysql root username and password with me and i am on centos server. I know how to login through putty to the mysql panel.
I am in. we are also connecting the mysql through Navicat and it accepts the SSH connection to the mysql server even we do provide the username / password because the server is not directly linked.
So, what is the possibility that i can change the Password of the SSH which is doing the mysql connectivity through navicat.
how can i use the command console panel to change the SSH to change it
Please do not vote for negative as if the question is not clear, ask me before downvoting
Regards
So, Here is the Solution.
When i was logging into putty, i was doing the ssh using my username and password, the same credentials i used in navicat and bang it worked, so there was no need to change the credentials, i already got it connected to my database, sory about the confusion, hopefully one should never encounter this issue, for me it was hard to debug as i was very new to centos operating system

how do i connect to mysql database in Linux server through windows machine

I have a MYSQL in windows that needs to connect with MYSQL in Linux server.but I want to know is there any way to connect MYSQL in Linux server without having MYSQL in windows.
Follow the following instructions:
1. Open Terminal and type in : sudo apt-get install putty
2. Click Y on subsequent messages that appear and let the installation complete.
To use Putty, go to Menu > Internet > Putty SSH client
To connect to a remote server that supports ssh login , enter the host name or the IP address of the remote host, in case you need to frequently need to login to this server , save the session by naming it something nice.
If the connection is initiated for the first time or if the server hardware configuration has changed, you may see the message. This is to ensure that you are logging in only to the trusted server that you know and not something else.Accept that.
Finally, enter user name and password to login to the server remotely, if all goes well you will see the terminal on the remote end.
connect to mysql :
type mysql -u username -p password
You can use putty software. Here is the link to download.
You can use putty for connecting mysql.
Connection string will like this
mysql -uDBUSER -pDBPASSWORD DBNAME -hHOST-IP
Or you can also use navicat or sql yog software to connect mysql on linux system on remote.

Question related to mysql gem new method authentication

I normally code on windows and using MYSQL4.1. And mysql gem version is 2.8.1. In my setup when I use mysql gem to access the MYSQL server, I give the root username and password of the sql server. And in rails db config file, I give user name as 'root' and its password and host as 'localhost'. My rails server and Mysql server are running on the same machine.
But recently I had to do a project in which I had to access the MYSQL server installed at a client site. It is a linux machine. I am not sure of the sql server's version number. To access it I was given a username and password for SSH and the root username and root password of the SQL server also. But for accessing that machine, in the mysql new method I have to specify the ssh login and user-password instead of sql user and password.
I cant access the DB if I give the MySql root user and password.
So, mysql.new(machine's public IP, ssh login id, ssh login password, db_name) works whereaes mysql.new(machine's public IP, 'root, root password, db_name) does not work. I am not sure, I understand what is happening. So, my question is can anyone explain this login behavior? Why cant I access the mysql server with the sql server's root login and root password.
To expand a little bit on what adamaig said:
When you're logged into the MySQL console as root, do this:
use mysql;
select User, Host from user;
MySQL should give you a table with the accounts and their respective hosts. You'll probably see that root can only log in from '127.0.0.1' or 'localhost'. You'll also probably see another account with credentials identical to those of the ssh account that was given to you.
Also, I would advise against giving root permission to log in from everywhere, it is a security risk.
But, if you ssh directly into the machine (using something like PuTTY if you're on Windows), you'll be able to log in as root from there.
Sounds like you need to create a user in the remote db that allows remote login. The root account is typically not given permissions to login from '%' . Try looking at the mysql.user table to see what the permissions are. Then you might want to look at the mysql.com developer documents on setting up accounts and security. The answers there will be fuller than can be given here.