MySql Workbench cannot open SSH tunnel - mysql

I have been using MySql Workbench successfully last week, but this morning, it systematically fails to open a SSH tunnel.
I have checked the logs and found the following:
16:46:47 [INF][ SSH tunnel]: Existing SSH tunnel not found, opening new one
16:46:54 [INF][ SSH tunnel]: Opening SSH tunnel to 192.168.200.254
16:46:55 [ERR][sshtunnel.py:notify_exception_error:235]: Traceback (most recent call last):
File "/usr/share/mysql-workbench/sshtunnel.py", line 303, in _connect_ssh
look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT)
File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 325, in connect
t.start_client()
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 492, in start_client
raise e
ValueError: CTR mode needs counter parameter, not IV
16:46:55 [INF][ SSH tunnel]: TunnelManager.wait_connection authentication error: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
16:46:55 [ERR][ SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
16:47:00 [INF][ SSH tunnel]: Existing SSH tunnel not found, opening new one
Yet, when I try to connect from a terminal, the SSH connection works fine. Any idea how to solve this issue?
Findings:
It seems like there might be a bug with version 6.3.9. I re-installed MySql Workbench with the following (I am on Ubuntu):
# The following will remove mysql too
sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update
# Then reboot your PC
# Re-install MySql Workbench from the Ubuntu software application

I had the same problem yesterday. My solution was remove Workbench and its dependencies and install it again. I use Ubuntu 16.04 and Workbench 6.3.6.

Related

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' . Error after installation

Errors
After running service mysqld status in Ubuntu 20.04, I get the error:
Unit mysqld.service could not be found.
And after running sudo mysql I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
Info
I've just installed MySQL with command
sudo apt-get install mysql-server.
There were no errors during installation. Reinstalling doesn't help. I've also tried to find problem in config files, but I don't have /etc/my.cnf. I am not sure, if it's ok.
systemctl start mysql does not help.
By the way, service mysql status works just alright and returns active status.
Resolved question.
Delete /usr/local/mysql, /usr/local/bin/mysql, /usr/bin/mysql
Reinstall MySQL by
sudo apt-get update
sudo apt-get install mysql-server

Problem with virsh / cannot connect to qemu

I am trying to setup KVM, but when running $ sudo virsh net-define br10.xml I get this:
error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
And when jumping into virt-manager GUI a get this dialog Unable to connect to libvirt qemu:///system.
I checked if I am in both kvm and libvirt groups and that seems okay.
I also checked if the libvrt-sock file is created when running $ sudo systemctl start libvirtd.service but there is nothing.
So it showed up that privilges for my files wasn't set correctly. Now everything works

Docker MySql Service Only Starts As Admin and Never Stays on with AWS AMI 2018.3

I am creating a development/testing container that contains a number of elements including a mysql server that must run internally for code to access. To demonstrate the issue, I run the following Dockerfile with docker run -i -t demo_mysql_server:
FROM amazonlinux:2018.03
RUN yum -y update && yum -y install shadow-utils mysql-server
Unfortunately, after building the docker container I receive a common connection error (see 1, 2)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
which can be fixed by logging in as admin with docker run -i -u 0 -t demo_mysql_server
and executing:
echo "NETWORKING=yes" >/etc/sysconfig/network
service network restart
/etc/init.d/mysqld start
chkconfig mysqld on
which seems to turn everything on. However, incorporating these into RUN commands doesn't seem to keep the service on and logging in as admin requires restarting the service as above and adding a user and working as a non-admin and trying to start the service results in errors of the flavor:
bash: /etc/sysconfig/network: Permission denied
[testUser#544a938c44c1 /]$ service network restart
[testUser#544a938c44c1 /]$ /etc/init.d/mysqld start
/etc/init.d/mysqld: line 16: /etc/sysconfig/network: No such file or directory
[testUser#544a938c44c1 /]$ chkconfig mysqld on
You do not have enough privileges to perform this operation.
I this a normal error to see and how do I get the MySQL server instance to stay running?

Unable to setup mysql in google cloud shell

I'm trying to install mysql in a cloud engine through the cloud shell
I installed it with:
sudo apt-get -y install mysql-server
And set password with:
sudo mysql_secure_installation
when I input the password, I receive this error:
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
How can I fix this?
As John say, Cloud shell is a container.
You should use cloud shell to login to your vm
For example, your VM name is mysql-server
gcloud compute ssh username#mysql-server
Then follow with your install setup.
Or
gcloud compute ssh username#mysql-server --command 'sudo apt-get -y install mysql-server'

how to setup and configure mysql-proxy on ubuntu on amazon ec2

i am trying to setup mysql-proxy on ubuntu on amazon ec2
i have done following:
sudo apt-get install mysql-proxy --yes
vi /etc/default/mysql-proxy
i put following content on "/etc/default/mysql-proxy"
ENABLED="true"
OPTIONS="--proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua
--proxy-address=127.0.0.1:3306
--proxy-backend-addresses=private_ip_of_another_ec2_db_server:3306,private_ip_of_another_ec2_db_server:3306"
also tied with "--proxy-address=private_ip_or_public_ip_of_proxy-server:3306 or 4040"
and "--proxy-backend-addresses=public_ip_of_another_ec2_db_server:3306,public_ip_of_another_ec2_db_server:3306"
after that i tried to connect proxy server from another pc using mysql like:
mysql -u some_user -pxxxxx -h proxy_server_ip
or
mysql -u some_user -pxxxxx -h proxy_server_ip -P 4040
but its not working
its showing error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'ip' (10061)
i want to tell you can connect the db server remotely where i allowed remote connection to any host
i also tried /etc/init.d/mysql-proxy start or /etc/init.d/mysql-proxy restart but no result
just to inform you that /etc/init.d/mysql-proxy stop is showing failed
can anyone please help me to setup and configure mysql-proxy on ubuntu
===
Edit
i found some help from other question of stackoverflow and also according to a suggestion in the comments, have done following procedure. and it seems its working now.
i installed mysql-client and mysql-server locally(on proxy server)
then i tried to run mysql-proxy using following command:
mysql-proxy --proxy-backend-addresses=10.73.151.244:3306 --proxy-backend-addresses=10.73.198.7:3306 --proxy-address=:4040 --admin-username=root --admin-password=root --admin-lua-script=>/usr/lib/mysql-proxy/lua/admin.lua
then i tried to connect remotely to the proxy server and its working.
but it seems i need to run this command under screen because when i close the terminal proxy stops working.
Can you please tell me that do i need to run this command under screen or is there any other way to make it alive all time?
There is no need to install Mysql client or Mysql Server on your mysql-proxy.
Installing mysql-proxy does have "full daemon capabilities" compiled into it.
If your are running Ubuntu Server, you may wish to use an UPSTART service script.
This script can be copied into /etc/init/mysql-proxy.conf
# mysql-proxy.conf (Ubuntu 14.04.1) Upstart proxy configuration file for AWS RDS
# mysql-proxy - mysql-proxy job file
description "mysql-proxy upstart script"
author "shadowbq <shadowbq#gmail.com>"
# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Essentially lets upstart know the process will detach itself to the background
expect daemon
# Run before process
pre-start script
[ -d /var/run/mysql-proxy ] || mkdir -p /var/run/mysql-proxy
echo "starting mysql-proxy"
end script
# Start the process
exec /usr/bin/mysql-proxy --plugins=proxy --proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua --log-level=debug --proxy-backend-addresses=private_ip_of_another_ec2_db_server:3306,private_ip_of_another_ec2_db_server:3306 --daemon --log-use-syslog --pid-file=/var/run/mysql-proxy/mysql-proxy.pid
In the above example I hard coded the AWS RDS server into script, instead of fiddling with defaults and config file
Install Upgraded version 0.8.5
Note:
apt repo does not have 0.8.5 so we need to download tar from mysql official site
Prerequisite :-
Create file /etc/default/mysql-proxy with following content
ENABLED="true"
OPTIONS="--defaults-file=/etc/mysql/mysql-proxy.cnf"
Installation Procedure :-
Download mysql-proxy 0.8.x
Untar in /usr/local
Update PATH environment with /usr/local/mysql-proxy-0.8.5-linux-debian6.0-x86-64bit/bin
vim /etc/environment (to update environment path)
cd /usr/local/mysql-proxy-0.8.5-linux-debian6.0-x86-64bit/bin
Run command sudo ./mysql-proxy --defaults-file=/etc/mysql/mysql-proxy.cnf
Sample mysql-proxy.cnf file
[mysql-proxy]
log-level=debug
log-file=/var/log/mysql-proxy.log
pid-file = /var/run/mysql-proxy.pid
daemon = true
--no-proxy = false
admin-username=ADMIN
admin-password=ADMIN
proxy-backend-addresses=RDS-ENDPOINT:RDS-PORT
admin-lua-script=/usr/lib/mysql-proxy/lua/admin.lua
proxy-address=0.0.0.0:4040
admin-address=localhost:4041
change host ip and port of RDS or mysql
connect to Mysql server via proxy with
mysql -h{proxy-host-ip} -P 4040 -u{mysql_username} -p