Mysql Workbench error "system error:61" - mysql

I have mysql installed several months ago. However I do remember using mysql workbench successfully at one point of time. Today I try launching it and get following error
Lost connection to MySQL server at 'reading initial communication packet', system error: 61

open /etc/mysql/my.cnf in a text editor and try changing:
bind-address = 127.0.0.1
to
#bind-address = 127.0.0.1
and then restart MySQL.

Try using the connection method: Local Socket/Pipe.

If you are trying to use the MySQL Workbench and connect through an SSH tunnel, you will get this error when your SSH connection does not complete successfully (e.g. improper host, password, key file, etc)
A good way to trouble shoot this is to separately test the the ssh connection from the machine you are trying to connect from and establish that you can do so succesfully.

I came across the same problem.I fix this below:
3306 port may be occupied by other process, so mysql change the port to 3307(or nearly other port 3308...).So when you connect,change the port to 3307 and try

Related

How to set the dsn of [inputs.sql] while using telegraf to connect MySQL?

I use docker-compose.yml to deploy MySQL, InfluxDB and Telegraf. I want to write the data of a MySQL database to an InfluxDB database through Telegraf. How to set the dsn of [inputs.sql] plugin while using telegraf to connect MySQL? Here are my settings:
It is said the dsn should be set as followed:
username:password#protocol(address)/dbname?param=value
My config turn out to be wrong:
E! [telegraf] Error running agent: starting input inputs.sql: connecting to database failed: dial tcp 192.168.48.5:3306: connect: connection refused
Can you tell me how to fix it?
Thank you very much.
Looks like there is connection issue there. Could you first test your MySQL connection from where the Telegraf agent is deployed?
Open a terminal from where the Telegraf agent is deployed
From inside the command prompt, type the command telnet 3306. In your case, that would be:
192.168.48.5:3306
Hit enter to activate the command. If the MySQL service is running, you will receive a response from the server. If not, please make sure the MySQL is up and running and the firewall is clear.

Python MYSQL will not connect

I have been helping troubleshoot a process on an old UBUNTU 16 server. We cannot migrate a site to a new server until we understand how it works as we need to recreate and troubleshoot.
Basically its a python3 script that connects to a MYSQL database and reads some data, and updates data under a certain condition. It is basically linked to ZOHO hence the need for this programming language.
The error has been diagonsed as a mysql connection error. Error 111 connection refused. The database is localhost
I have 100% verified the access for the username, password and database visibiity and that port 3306 is open. I can login using a MYSQL command on the CLU and show the database and its tables.
The connector is 100% pulling in the correct variables from the config.py as I have added a print(HOST, DBASE, USER, PASSWORD) just before the connector and verified they are correct.
I have also tried 127.0.0.1 instead of localhost. I have also (dont shoot me) put in the root username and password to remove any permissions issues
I am wondering if its possible to expand on the mysql error in python so I can get a very clear message as to WHAT part is causing an issue. Is there any command in MYSQL that could have been issued to specifically block python.
I have disabled UFW just in case, made no difference, and the general logs for MYSQL dont appear to contain anything useful
Exact error:
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (111 Connection refused)
Note: The server is Ubuntu 16, running MYSQL 5.7.26-0ubuntu0.16.04.1 with localhost access only. Python is 2.7.12
As noted this is an old server, that I want to scrap ASAP but until I can prove that the zoho connector is fixable, we cant proceed as its a blocker.
As you can see in theexample below.
the port is separate from the host
import mysql.connector
cnx = mysql.connector.connect(
host='localhost',
database='import_test',
user='testuser',
password='password***',
port=3306
)
Turns out to be the most basic of all issues. On the old server we cloned from, everyting was open, zero lockdown including MYSQL listening to the world. On the new server, mysql had skip-networking was enabled.
Whereas the web instances were happily connecting directly to the socket, mysql was not activly listening on port 3306. I had changed my.cnf to enable networking but a different issue was stopping those changes taking place.
Once I had mysql working on port 3306 and I could see it listening, python now connected ok so some of the answers were correct. MYSQL was 'not working;' in a global sense.. HOWEVER this is a step backwards in terms of security. I did not want MYSQL open to the world
So I modified the code to use the unix socket of /var/run/mysqld/mysqld.sock, renenabled skip-networking and voila.. all is now fine with python, port 3306 is shutdown again and I have my first trial by fire of python complete
My config file defines DATABASE as local host, USER and PASSWORD but now has SOCKET as /var/run/mysqld/mysqld.sock and my code is
import mysql.connector
from models import ExportRecord
from config import HOST, USER, PASSWORD, DATABASE, SOCKET
def connect():
return mysql.connector.connect(host=HOST, user=USER, passwd=PASSWORD, database=DATABASE, unix_socket=SOCKET)

Problem with mysql workbench and xampp server

I am trying to create a project with mysql. For the past two days I had been using XAMPP server for the mysql server and mysql workbench to use it and it has been working perfectly. Today after having to restart my pc for a windows update, when I turned on the XAMPP mysql server and tried going to my connection in mysql workbench, mysql workbench is giving me an error
Could not connect; Server may not be running Message: Lost connection to mysql server at 'waiting for initial communication packet'. system error 10060
I have tried multiple solutions; Changing the port of the mysql server. Using a different username and password, the root username. And have tried restarting my computer multiple times to fix the problem. If any more information is needed to find the problem I will update this question to provide more information.
UPDATE 1:
I left my laptop running and when I returned the workbench had connected successfully. I believe the problem comes from restarting the pc as the day after I posted this question I restarted my pc to fix a problem and I am currently having the same situation.
Maybe the problem is the Windows Firewall or the Antivirus.
If the server is running all the time and the service not stop, the port is blocked.
Check if the default port is Listening:
C:\Windows\System32>netstat -an |find "3306"
Or you can use the Microsoft Tool PortQry.exe download from:
https://www.microsoft.com/en-us/download/details.aspx?id=17148
Example of use:
C:\PortQryV2>PortQry.exe -n 127.0.0.1 -e 3306
Querying target system called:
127.0.0.1
Attempting to resolve IP address to a name...
IP address resolved to WF-SA02
querying...
TCP port 3306 (unknown service): LISTENING
C:\PortQryV2>
Might be an SSL problem. The problem is: XAMPP does not use SSL and MySQL Workbench uses SSL as a default setting.
You can select "If available" in the Use SSL dropdown box of the SSL tab of the connection pane. Use the tool icon in the startup window to edit already existing connections. Works in MySQL Workbench 8.0.28+

Can't connect to MySQL server on 'IP' (111)

It is impossible to connect to mysql that I setup with phpmyadmin on a debian 8 VPS. I have been searching for hours, I have even followed this guide http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html but nothing, it seems imposible to get to connect to it, I even have created a phpmyadmin profile that is not on localhost and on %...
Thanks a lot for helping...
111 means connection refused, so make sure your mysql config is correct, and check your firewall.
Mysql config details (from Can't connect to MySQL server error 111):
If you have lines like this :
skip-networking
bind-address = 127.0.0.1
In your my.cnf configuration file, you should comment them (add a # at the beginning of the lines), and restart MySQL.
That's the first thing to try. Then try turning off any firewall and connecting again. That will tell you whether there's a firewall problem.

connection to mysql server from clojure

I'm trying to connect to a mysql database from clojure. I'm using the example code taken from:
http://corfield.org/blog/post.cfm/connecting-clojure-and-mysql but I'm getting this error:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.
The mysql server is bound to 127.0.0.1:3306. Changing localhost to 127.0.0.1 in :subname doesn't help. I have set the mysql server to log everything for debugging, and it doesn't even see a connection coming. What am I doing wrong here?
I can connect to the db using mysql -h 127.0.0.1. But this fails to connect if I change 127.0.0.1 to localhost. my.cnf contains: bind-address = 127.0.0.1 and as I write above, changing to 127.0.0.1 in :subname doesn't help. The thing that did the trick was putting mysqld : ALL : ALLOW in /etc/hosts.allow. I have no idea why this is needed, especially when all the other services that contact the MySQL server work without it.