Unable to access server database schemas in mySQL Workbench - mysql

So I'm working in a team and my computer in particular is running into issues that other people's computers aren't running into, so none of us know how to diagnose the issue. I am running on a Mac with El Capitan. These are the steps I took to connect and access the server database:
SSH into server's terminal:
ssh -i ~/.ssh/your_private_key username#serverIP
Port forwarding through ssh:
ssh -L 3306:localhost:3306 -i ~/.ssh/your_private_key username#serverIP
Error: bind: Address already in use
I go into System Preferences > mySQL > stop mySQL server instance
I go into mySQL workbench and choose connection method Standard TCP/IP over SSH
Enter in all the information and clicked Test Connection and get this popup message:
Information related to this connection:
Host: 127.0.0.1 Port: 3306 User: [username here] SSL: not enabled
A successful MySQL connection was made with the parameters defined for
this connection.
My team members were able to see all the database tables that they worked on under the schemas section, but my Schema section shows nothing. What am I missing and why can I not see the schemas despite getting a successful connection message?

Related

Connect to remote db with ssh tunneling in DBeaver

I know this question was already asked before (like here), but still I could not find a solution and those posts are quite old.
So I am able to connect to the remote db with an ssh connection and then use the command line like this:
// Putty SSH Connection
host: ssh.strato.de
port: 22
username: xxxxxxx
password: xxxxxxx
// connect to mysql with terminal
mysql -h rdbms -u xxxxxxx -p xxxxxxxx
If I try the same with ssh-tunneling in DBeaver I get an connection error
The ssh-tunneling itself seems to work. If I use the same credentials as above and press "Test tunnel configuration" I get a success message.
I tried several other options for port and host (localhost, rdbms.strato.de, etc), which I found via mysql show variables; show processlist; show user();, but none of them worked.
The Strato Support told me that I can only connect to the db internally with phpmyadmin or remotely wiht putty and mysql, but since the last method is working, shouldn't ssh-tunneling also work?
Dbeaver - Database connection using SSH Tunnel
Open dbeaver
Click on "New Database Connection", in the following "main" window enter the MySQL server host relative to the SSH server, and MySQL running port, my setting is default (localhost, 3306)
specify MySQL user to connect with and user password.
In the "SSH" part, specify the SSH host, port, user also the authentication method used, like SSH private key
Test connection and use.
On shared hosting setups (e.g. IONOS) there might be a restriction when trying to connect to MySQL from external client
https://www.ionos.com/help/hosting/troubleshooting-mysql-databases/connection-and-access-problems-with-mysql-databases/

Can't connect to digital ocean LEMP stack MySql via Workbench (or any gui) but CAN connect via terminal mysql cmd

I have tried suggestions in what seems like every post about this topic and none of them have worked for me, so I'm posting my own in case anyone spots anything that I missed.
I'm migrating a wordpress site into a LEMP (ubuntu, apache) stack instance on Digital Ocean, and I need temporary access to the database via MySQL Workbench or something similar on my local machine. I'm planning to turn it off once the migration is done. However I am having a very weird issue I can't figure out the cause for.
If I attempt to sign into the sql instance using
mysql -u user -h my.ip.address -p
I can get access from my local machine just fine.
I can also SSH into the server itself via terminal just fine, I have it set up in my ssh config file using the same ip address and the same user and ssh key i'm attempting to use for my workbench connection.
However doing the same via an SSH connection on workbench I constantly get the error:
Authentication failed, access denied.
Failed to connect to MySql at my.ip.address:3306 through ssh tunnel at user#127.0.0.1 with user mysqluser
Things I've done to attempt to rectify this:
set bind-address in mysql config to 0.0.0.0 on the server and restarted server's mysql
set bind-address in mysql config to my.ip.address on the server and restarted
allowed tcp connection
allowed connection via ufw firewall to 3306 and 33060 ports
created a mysql user with all privileges granted for 'localhost', '%', and '0.0.0.0' hosts
tried sshing in as root user
tried using the root user for the mysql user
I am probably missing some things on that list as I feel like I've tried a million things already!
I even have a different server on a LAMP stack (not LEMP) that I set up a few days ago and was able to gain access to the mysql db on workbench by following the same steps, and even attempted backtracing and copying what I did on the LAMP server, but no go.
I checked to see the netstats of the mysql instance and match the port and the ip and that didn't work, I made sure the port of the SSH was correct, nothing is working.
Does anyone have any tips? I've been using all of the "allow remote mysql connection on digital ocean" articles and questions i can find but nothing is working.
Here is my Workbench connection config at the moment but i have tried what feels like every iteration of it i could think of (re users, passwords, IP addresses, and ports)
SSH Hostname: my.ip.address
SSH Username: user
SSH Password: user-password (also tried empty, since i have a key)
SSH Key File: same key file i use to ssh on terminal
Mysql Hostname: 127.0.0.1 (also tried my.ip.address)
MySql Server Port: 3306 (also tried 33060)
Username: MySqlUser
Password: MySqlUser-Password (works when connecting to mysql via terminal)

Can't access MySQL through MySQL Workbench or HeidiSQL, but can access through shell

I don't know if this is a user error on my end, or if the remote server is configured incorrectly.
I was given some connection info for a server as follows:
Server IP
server username
keyfile
mysql user
mysql password
and I can shell in and run the "mysql" command with the mysql user and password I was given, but I can't setup a connection in either MySQL Workbench or in HeidiSQL.
In MySQL Workbench, the 'Standard TCP/IP over SSH' seemed to best fit the info I was given, but when I try to connect I get "Authentication error. Please check that your username and password are correct and try again." or "Authentication error opening SSH tunnel: Authentication error. Please check that your username and password are correct and try again." in the logfile.
In HeidiSQL the "MySQL (SSH tunnel)" seemed to best fit the info I was given, but when I try to connect there, I get "Lost connection to MySQL server at 'reading initial communication packet', system error:0"
I looked up both these errors and couldn't find anything for the first one, and the second one seemed to be more about server configuration. I'm not too savvy with server config, so I'm a bit stuck evaluating whether or not I'm doing something wrong on my end, or if something needs to be changed on the server. I'd appreciate some advice. Thanks!
You must be more specific about the credentials you got. Is "server IP" the IP address of the MySQL server or an SSH server? Is the "server username" the SSH user or something else (e.g. a regular user of the target machine)? In my tutorial video on Youtube I explained what you have to use where to create a connection, including SSH connections: https://www.youtube.com/watch?v=DCgRF4KOYIY
You have to check a couple configuration steps before you can perform a remote mysql connection:
First of all you must check that mysql default port(3306) is listening on the correct interface.
You can check this out using netstat command in the remote server:
# netstat -tulnp
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1111/mysqld
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
Then you must check that the remote host is allowed to perform querys into mysql engine (you must check user and host permissions over your database).
Connect into terminal and run the following command in mysql prompt:
mysql> select user,host from mysql.user;
Check the following link to deep insight mysql user and hosts system:
https://dev.mysql.com/doc/refman/5.0/en/adding-users.html
Check user,host permissions over your database:
mysql> show grants for root#localhost;
https://dev.mysql.com/doc/refman/5.1/en/grant.html
You must check that remote host (client) exist for example: user#192.168.1.2
Finally if you are using putty to encrypt over ssh you connection please check that you rsa key fingerprint is added you can perform this just logging ssh using you putty client.

Navicat - lost connection to mysql server at 'reading initial communication packet', system error: 0

I am getting the error listed above when trying to connect to my MySQL server via SSH public key in Navicat. I have searched endlessly trying to find a solution to this. I have made sure that the AllowTCP option is enabled, and I have tried setting the hostname to localhost and 127.0.0.1 but neither of them work, it only changes the error to Connection Refused.
Here are my connection properties:
(General Tab)
Hostname/IP Address: mydomain.com
Port: 3306
Username: myusername
Password: mypassword
(SSH Tab)
Hostname/IP Address: mydomain.com (have also tried localhost/127.0.0.1)
Port: 3850 (this is the correct port)
Username: myusername
Authentication Method: Public Key
Private Key: C:\Path\To\My\Key
Passphrase: mySSHpassword
I know that probably isn't much help because there's not really any "settings" other than the ports, which I know are correct.
I am running these exact same credentials on my Macbook which runs SequelPro and it works flawlessly, so I'm lost as to why I can't get it working on my PC through Navicat.
Thanks for any help you can provide.
The General tab would be set to localhost (or 127.0.0.1) and the username and password would be the database credentials, not the host credentials.
Then the SSH tab would be your host with the username password you use to ssh to the host. It should be the normal ssh port 22.
I was able to get my Navicat connected using SSH to my Rackspace MySql database from my OS X (MacBook).
The key was the settings in the General Tab. I had to set the HostName/IP to the remote name of the MySql Server.
[identifier-from-the-mysql-hostname-instance].rackspaceclouddb.com then the username and password as defined for my MySql database.
The SSH described in the prior responses, matched my settings.

Unable to connect from MySQL Workbench to server (System error 61)

MySQL error:
Failed to Connect to MySQL at 12.34.567.890:3306 with user jsdbadmin
Lost connection to MySQL server at 'reading initial communication packet', system error: 61
Using:
Plesk, SuSE vServer, fresh installation: completly new about an half year ago.
Software:
Trying to connect via MySQL Workbench, current version.
Hostname: 12.34.567.890 (modified for privacy), also tried with domain
Port: 3306
Username: My DB user name, as specified in Plesk when DB was created.
Password: *************
Default Schema: feeds
Tried TCP/IP, TC/IP over ssh.
Searched online:
These settings are not the problem:
#skip-networking
#bind-address = 127.0.0.1
Both already commented out.
Do you have a Firewall blocking the connection ?
You can test by telneting to the mysql port.
you also need to allow the ip/user combos that are allowed to connect
e.g.
to add a new user
GRANT ALL ON jsdbadmin.* TO remoteadmuser#'12.34.567.890' IDENTIFIED BY 'PASSWORD';
or
to grant access to a specific ip
update db set Host='12.34.567.890' where Db='yourdatabase';
update user set Host='12.34.567.890' where user='jsdbadmin';
Another possible (really annoying) error is that the server's public ssh keys have changed since your last login or that you've never logged in to that server using SSH and therefore you must manually approve them.
To solve this:
$ nano ~/.ssh/known_hosts
Remove old server keys from the file. Save & exit.
Connect to the server manually (ie. from terminal) and approve saving the new keys
After successful login from terminal, retry the mysql connection over ssh.
That worked for me...