MySQL Workbench not connecting over SSH - mysql

I installed a server using Laravel Forge. Authentication is via SSH keys which I provided.
I can connect to the server via putty with my private key. Also am able to connect to the mysql using the mysql password.
But when I try to do the same in Mysql Workbench I get this:
My keys are in .ppk format. The keys don't have a password.
I have no idea what to do. Please assist.

I don't know if that applies here, but if you use an older version of MySQL Workbench try the latest one (currently 6.2). For the SSH connection: you need an OpenSSH type key, not putty (ppk). You can use putty to convert to OpenSSH format, however.

I would like to complement Mike's answer, and include the step-by-step for those who don't know the use of Putty to perform the conversion that Mike refers to.
Open the PuTTYgen program > Conversions > Import Key > 'Select your key with the .ppk format' > Export OpenSSH> Select the directory and save the new format.
Use this file into mysql worckbench and it will work.

The problem is indeed that the "MYSQL Hostname" needs to be "localhost" or "127.0.0.1".

The MySQL hostname must be relative to the SSH server.
If your MySQL server is on the same machine as the SSH server,
try using 'localhost' instead of your SSH server's IP.

For me, the default package in ubuntu 18.04 using "apt install mysql-workbench" install the v6.3.8 that have a bug with ssl/tunnel connection (along with the 6.3.9)... I purged/unistalled it and installed the latest deb version from the website https://dev.mysql.com/downloads

Related

Can't connect to MySql DB through ssh usign Workbench after update

I'm facing a strange problem here...
My database is in a AWS EC2 and I was used to connect to it through SSH using MySql Workbenh.
To do it, I generated a passphrase protected ppk file using puttygen on ubuntu 16.04 and it worked fine.
But after an update, using the same configuration, I receive this error message:
Could not connect the SSH Tunnel
Authentication error. Please check that your username and password are
correct and try again. Details (Original exception message): Bad
authentication type, the server is not accepting this type of
authentication. Allowed ones are: [u'publickey']
So, searching on Google I found this two guys with the same problem: this, and this.
The solution proposed is generate a public open-ssh file and use it, then it was I did:
puttygen myKey.ppk -O public-openssh -o myKey.ppk
And the problem stills the same! I'm not sure if the Workbench update (it is in 6.3.10 version now) caused this issue, but before that I could connect with no problems.
I can connect normally in server through ssh in ubuntu terminal.
What I can do?

Can't connect to MySQL database using Coda 2

I am hosting a website on a Raspberry Pi that has a MySQL server running.
Using Terminal on Mac, I can remotely ssh into the RPi and then connect to the server.
I am trying to remotely connect to the server using Coda 2, but it doesn't seem to be working. I chose the 'via SSH' option, using the following details:
(I've removed my login details)
However, using the exact same details with SequelPro, it works just fine?
What is going on here? Why is it not working for Coda?
This is a known issue with Coda 2. I'm going to assume you're using SSH keys, if not please elaborate.
Open ~/.ssh/config, you'll need to use sudo vim/nano/emacs because its a protected file. Then add these two lines:
Host 192.168.1.108
IdentityFile /the/path/to/your/ssh/key
This asserts the identification of the SSH key.
Reference to the Coda docs: here
Please use server as 192.168.1.108 (your server ip address) not 127.0.0.1
Thanks

Power BI not connecting to MySQL

I am trying to connect Power Bi (Desktop version) with my online amazon mysql database. It demands for following information once you try to establish connection
Server: server ip
Database: database name
Username: mysql username
Password: mysql password
First time I received a bit lengthy error, which was because of unavailability of mysql-connector-net-6.6.5.msi. So I followed this link to solve the issue
Microsoft Power BI connect to mysql
After installing mysql-connector I am facing another error.
Whats wrong? One of my mates has successfully connected using the same credentials that I am using.
Okay, I just figured this out for myself. I'm able to connect directly to a MySQL database on port 3306. As I understand, it would be more secure to go through an SSH tunnel, but this doesn't work yet with Power BI.
So here are instructions for connecting directly:
First, let's make sure that everything besides the PowerBI connection is working.
1) Download and install the correct version of the MySQL/Net Connector. Right now, version 6.6.5 is the one that works. But from other forums, and from within PowerBI itself, I linked to other versions that did not work. (You will know it isn't working, because you probably won't be able to even open Get Data/MySQL Database/Connect.)
2) See if you can connect remotely to your database through some well established utility like MySQL workbench. If you can't,
- look at ports on the remote server. Here's a cool utility to check ports&IPs: http://www.yougetsignal.com/tools/open-ports/
- Check the permissions of the DB user. Realize that they may be affiliated with an IP address: 'username'#'ipaddress'. So that user can only connect for a particular IP.
- Check the bind address setting. In newer versions of mariadb, it should probably be commented out. I'm not sure about older version and pure mysql.
- other troubleshooting.
So after that's working, here are the settings which worked for me in MySQL:
go to Get Data/MySQL database/connect
Server: ipaddress:3306 (include ":port#")
Database: dbname
PowerBI interface. Select "Database" instead of "Windows"
Make sure you select Database instead of Windows.
Good luck.
Just a small tip. If you haven't already, restart the machine you just installed the connector on. I had to restart before it started working.
My solution for this was to add the port number to the server name/ip
eg. 192.168.0.1:4664

Cannot connect Wordpress to MySQL database

Doing some local website work to learn Wordpress theme development.
Tried to set up Wordpress through the prompts, also tried it by manually entering information in the wp-config.php file, neither would work. Still cannot connect to the database, the setup-config.php page returns "Error establishing a database connection". I've double, triple, and quadruple checked the login credentials (database name, username, password etc.), they are complete and correct. Deleted wp-config.php and tried again through the web page, same result.
MySQL is definitely running, the Mac System Preferences panel says so, and I can login and run SQL queries at the command line, although I have to do that as root. Should I be running MySQL as root?
This problem exists with Wordpress and also with an instance of phpMyAdmin that I've also installed, so I don't think it's anything to do with the PHP code as such, it smells more like a permissions thing. For what it's worth, I've edited my httpd.conf file to get Wordpress on port 80 and phpMyAdmin on 8081. Apache is serving those sites up as it should and PHP is running, it's just getting either site to connect to the database that's the problem.
System information:
Mac OS X 10.9.5 (Mavericks)
PHP Version 5.4.30
MySQL version:
mysql Ver 14.12 Distrib 5.0.45, for apple-darwin9.2.0 (i686) using EditLine wrapper
In my case it was as simple as changing the DB_HOST so it was using the correct host and port in wp-config.php:
define('DB_HOST', '127.0.01:3306');
I found the solution on this stackoverflow page.
By default, Apache cannot send requests to a remote MySQL server. It should be enabled.
On CentOS 6 the solution is the command:
setsebool httpd_can_network_connect=1
Check your phpinfo(); to see if MySQL extension for php is installed.
I experienced a similar issue and it turned out that the authentication type used by MYSQL was not supported.
To verify this, add
define('WP_DEBUG', true)
in the wp-config.php and re-run the installation. You will see an entry indicating if that's the case.
If the issue is confirmed to the authentication method, try
mysql> CREATE USER ‘username’#‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
after logging in to mysql console.

MySQL Workbench (version 6.0.8) SSH Authentication Issue

I am trying to connection to a MySQL server on Host X through machine Y over SSH.
The same setup (but older version of MySQL workbench) works on my another box (CentOS 6.3).
However, the same setup doesn't work on my CentOS 6.5.
I tried to use the SSH key for authentication between my box and machine Y over SSH, and it works when I ssh from my box to machine Y.
However, MySQL workbench gave me the following error:
ERROR Could not establish SSH connection: Bad authentication type (allowed_types=['publickey', 'gssapi-with-mic']).
Some people suggested that I set AllowTcpForwarding to yes in /etc/ssh/sshd_config, which I did, restarted the service and rebooted my machine.
But I still got the same error.
Any idea?
It seems like for some reason the .ssh/id_dsa key isn't picked up when MySQL workbench attemtps to connect.
Thanks in advance.
You need to ensure that your private key is in openssh format. With puttygen you can export as Openssh. This worked for me.
Converting it to OpenSSH solves the issue. Just do the following:
Open Putty Key Generator.
Load the private key by going to File - > Private Key from the location you saved the private key file in - you should see your key loaded in Putty.
Now go to conversations and export to Openssh - save the file in a safe location.
Go to Workbench and under SSH key file point it to the new Openssh file instead of the old private key file. this should solve your problem.
I've just come across this again recently. If you use a password protected private key and you just upgraded to macOS Sierra you probably need to re-add your private key to your keychain again.
ssh-add -K ~/.ssh/id_rsa
This instantly fixed the problem for me.
On Mac OS, do the following as this is the only thing work for me -:
Step 1
brew install putty
Step 2
puttygen id_rsa -O private-openssh -o id_rsa.pem
Step 3 - In MySQL workbench
SSH Key File: /Users/local/.ssh/id_rsa.pem
I had the same problem on macos with both Navicat and MySQL Workbench. Thanks to Jonathan on this article
figure my issue out. Macos users first need to install puttygen and then convert ppk format into pem by means of Jonathan said in his tutorial and then TADA! everything works like a charm!
for linux and generally for workbench it must to be in pkcs8 format intead of rfc...
so export in OpenSSH format but in pkcs8
For me, it worked using a .pem extension key.
As I only had the ppk key, I had to transform the .ppk into .gem.
To transform it, I used eating in the ubuntu terminal:
$ puttygen key.ppk -O private-openssh -o key.pem
For Linux users using ssh-keygen:
As per the other answers you need to use openssh format.
ssh-keygen -o -b 4096
That gives me a new keypair RSA type 4096 bits in openssh format. It's the -o that's key here (no pun intended).
Obviously this generates a new key so is only useful if you can upload the new public key to the server. Don't forget to back up your old keys first incase you use them elsewhere.
AFAIK ssh-keygen doesn't have the ability to convert an existing key.
Why Oracle have dropped support for the ubiquitous PEM format is beyond me.
I spent 3-4 days to figure out and tried many different solution but none of them worked for me except following.
I was on Windows and using XAMPP to run MySQL and localhost. I stopped both services on my machine and then tried to connect SSL connection using Workbench and its connected.