secure auth error connecting to SQL server from RMySQL - mysql

I m trying to connect to a MySQL server on a VM from RMySQL, here are the commands i executed
c<-dbConnect(MySQL(), user="root", password="passw0rd", dbname="leopard", host="one-1368")
It is showing the following error
RS-DBI driver: (Failed to connect to database: Error: Connection using old
(pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)
I m using MySQL client 5.6 on my system and the VM shows that it is running 5.5. I think it might be an issue on the server version.
Any help would be appreciated. Thank You

You may have an old my.cnf configuration on your local machine. You can override the client option secure_auth in my.cnf or in a specific config file you pass to dbConnect()
dbConnect(MySQL(), default.file="your-file.cnf"
The info on the setting is here:
https://dev.mysql.com/doc/refman/5.6/en/mysql-command-options.html#option_mysql_secure-auth
As an aside, you should really not be using 4.1-style password hashing :)

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.

Unable to connect to MySQL Server with both the MySQL Command Line Client and mysql connector for python

I recently setup MySQL Server on my computer. But the command line client asks for the password and simply closes without showing anything.
The mysql connector for python can't connect to it either.
import mysql.connector
mydb = mysql.connector.connect(username='username',passwd='password')
Just gives
InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (10061 No connection could be made because the target machine actively refused it)
I saw somewhere that setting the host to localhost might help.
import mysql.connector
mydb = mysql.connector.connect(username='username',passwd='password',host='localhost')
But even then:
InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)
The target machine actively refused it?
This already happened once and I reconfigured MySQL Server from the MySQL Community Installer which temporarily got it to work on both the command line client and with the python connector. Is there any way to permanently fix this?
Here are the versions of software I'm using:
MySQL Server 8.0.21
MySQL Server Installer 1.34.4.0
Python 3.8.2
JupyterLab 2.1.2
EDIT: Should've mentioned I'm running Windows 10.
#replace username as user and it should work
import mysql.connector
mydb = mysql.connector.connect(user='username',passwd='password',host='localhost')
If the MySQL80 Command line Client it is closing after you enter the pwd means that you're entering a wrong password. Typically the password that it's asking is the root password.
For such a case check this page:https://dev.mysql.com/doc/refman/8.0/en/mysql-installer-workflow.html#mysql-installer-workflow-server and eventually you may have to reset your root pwd and your user accounts.
With the help of #Erick, I got MySQL working for me. So MySQL is usually installed as a service on windows and is set to manually start every session. This was why reconfiguring worked but only that once. What you need to do is go to services, and look for MySQL80. If it isn't already running (which was what happened to me), double-click it to start, and set 'Start type' to automatic so that the MySQL Server starts automatically during system start-up. For me, doing this made both the client and python able to connect to the server :).

[MySQL][ODBC 5.3(a) Driver]Can't connect to MySQL server

I have difficulty connecting to MySQL server from Tableau Server.
The error message is:
[MySQL][ODBC 5.3(a) Driver]
Can't connect to MySQL server on XYZ.
Unable to connect to the MySQL server "xyz".
Check that the server is running and that you have access privileges to the requested database
I have installed MySQL ODBC 5.3 Driver from tarball distribution in Ubuntu OS, and whitelisted the IP address of Tableau server in MySQL server.
What could be the possible causes for this? And is there any way that I check the ODBC connector was properly installed?
Any suggestion/comments are much appreciated!
Reasons, you could not connect could be different. But the error you've get asks you to check if server is running. It means, it could not find server.
The reasons, it could not find server, could be:
Server is down (Check its status by systemctl status mysql)
Server is not listening on some port your app connects to
Server is behind firewall (sudo ufw allow mysql command execution required to solve it in this case)
Your user does not have permissions to access that database, as it states in the error

Liquibase can't connect to the SQL Server [duplicate]

This question already has answers here:
Connect Java to a MySQL database
(14 answers)
Closed 5 years ago.
I am fairly new to liquibase and try to set it up on my own computer, running Windows 7 with a local MySQL Server. I have installed the JDBC driver (4.2), opened the TCP/IP Port 3306 on my Firewall and the Server, installed liquibase and added it as a PATH in the environment variables.
As a first command i tried using this:
C:\Users\Marius>H:\Liquibase\Liquibase \
--driver=com.microsoft.sqlserver.jdbc.SQLServerDriver \
--classpath="C:\\Program Files\\Microsoft JDBC Driver 6.2 for SQL Server\\sqljdbc_6.2\\enu\\mssql-jdbc-6.2.2.jre7.jar" \
--url="jdbc:sqlserver://localhost:3306; databaseName=Test" \
--changeLogFile="H:\Liquibase\dbchangelog.xml" \
--username=liquibase \
--password=liquibase \
Update
But when executing I only get:
Unexpected error running Liquibase:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection
to the host localhost, port 3306 has failed. Error: "Connection
refused: connect. Verify the connection properties. Make sure that an
instance of SQL Server is running on the host and accepting TCP/IP
connections at the port. Make sure that TCP connections to the port
are not blocked by a firewall.".
The Server is definitely running since I am able to connect to it with telnet, mySQLWorkbench and several other tools.
When running the command with --url="jdbc:sqlserver:localhost:3306; databaseName=Test", I get a different error code.
Unexpected error running Liquibase:
liquibase.exception.DatabaseException: Connection could not be created
to jdbc:sqlserver:localhost:3306; databaseName=Test with driver
com.microsoft.sqlserver.jdbc.SQLServerDriver. Possibly the wrong
driver for the given database URL
I tried this again on another computer with a SQL Server 2017, a different JDBC driver (6.0 and 6.2) and Windows 10 as the OS.
Deactivating the Firewall doesn't do anything, neither does a clean install of everything.
Any help is appreciated.
MySQL is a different product to Microsoft SQL Server. Given you have said you can connect using MySQL workbench, this is probably the product you have installed.
Instead of trying to connect to the non-existent Microsoft SQL Server, try using a MySQL driver instead.

phpmyadmin and mysql socket error

once i try to connect to mysql on phpmyadmin in ubuntu i got this error
2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
but with mysql query browser i connect with out any error and it works
why phpmyadmin does not connect?
The command line client uses a unix domain socket while PHPmsyqladmin uses a network socket. You'll need to enable the network socket in the mysql config, most likely.
EDIT:
You can read about some of the troubleshooting (and windows) side of this: http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html
And here is how to set up mysql to use a network config:
http://www.howtogeek.com/howto/mysql/switch-mysql-to-listen-on-tcp/