Using MyXQL with Phoenix - Can't connect to database - mysql

I am using the MyXQL driver with Ecto in Phoenix, and am trying to connect to an already existing MySQL database running on a Debian 11 server.
I can access the server normally using mysql -p, and can access it through Express (which is what I was using before I started migrating to Phoenix / Elixir).
When I try to run:
{ :ok, pid } = MyXQL.start_link([ username: "{username}", password: "{password}" ])
I get an error that reads:
[error] MyXQL.Connection (#PID<0.449.0>) failed to connect: ** (DBConnection.ConnectionError) (/tmp/mysql.sock) no such file or directory - :enoent
I understand that this means it can't find a /tmp/mysql.sock socket, however I cannot figure out how to fix this error, or why it even is an error, considering ExpressJS can access the server (using the npm package mysql).

Related

Error 1045 access denied from DMS source database

I got below error while try to migrate database from Mysql enterprise version 8.0.23-commercial even I grant all REPLICATION CLIENT, REPLICATION SLAVE to migration user I still got this error and also turn on binlog
[SOURCE_CAPTURE ]E: Error 1045 (Access denied for user 'migration'#'IP' (using password: YES)) connecting to MySQL server 'IP' [1020414] (mysql_endpoint_capture.c:297)
2021-09-28T17:46:20 [SOURCE_CAPTURE ]E: Errors in MySQL server binary logging configuration. Follow all prerequisites for 'MySQL as a source in DMS' from https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MySQL.html or'MySQL as a target in DMS' from
https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.MySQL.html [1020414] (mysql_endpoint_imp.c:778)
If migrate full load only via this endpoint it successfully this error found when full load + on going migration
To replicate database migration must use TCP/IP port. You should check this port and run database migration again.
I faced same issue while working on AWS DMS RDS mysql to MSK Kafka data migration. I resolved by configuring mysql source endpoint with Secure Socket Layer (SSL) mode verify-ca.
To get a certificate bundle that contains both the intermediate and root certificates for all AWS Regions, download from https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem.
You can valuvate your error in following doc
https://www.percona.com/blog/2019/07/05/fixing-a-mysql-1045-error/

Linkedin WhereHows - Docker Backend not able to connect to MySQL

When I try to connect WhereHows backend to MySQL DB in Docker environment I am getting following error message (I checked IP, Username and Password and all 3 are good):
1) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [wherehows]]
At the same time, WhereHows web is connecting without any problem.
Docker version is 17.12.0-ce and I am using following images:
wherehows/backend
wherehows/web
wherehows/mysql
This is my config file - /backend-service/conf/application.conf
# connection to wherehows mysql database
db.wherehows.driver = com.mysql.jdbc.Driver
db.wherehows.url="jdbc:mysql://localhost/wherehows?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false"
db.wherehows.username="wherehows"
db.wherehows.password="wherehows"

Migrating Data from Remote MySQL server to Rails App

This is a follow up question to "How to create a ssh tunnel in ruby and then connect to mysql server on the remote host" from 5 years ago.
I'm trying to create an SSH tunnel in Ruby and then connect to a remote MySQL database. I'm doing this because I need to move some legacy data from an older version of my app, so I don't need ActiveRecord, migrations, etc.
I'm using the NetSSHGateway gem and the MySQL2 gem.
Here's my Ruby code (run in rails console):
gateway = Net::SSH::Gateway.new('old_remote_server.com','server_username')
port = gateway.open('127.0.0.1', 3306, 3307)
client = Mysql2::Client.new(
host: "127.0.0.1",
username: 'database_username',
password: 'database_password',
database: 'database_name',
port: port
)
After the last line, the console hangs for about 2 minutes, and then gives me the error:
Mysql2::Error: Lost connection to MySQL server at 'reading initial communication packet', system error: 0
I am able to SSH into the remote server, and execute MySQL commands that way, so I'm not sure what the issue is here.
After some thought, this isn't likely the best way to migrate data, for a few reasons.
In the end, I simply dumped my legacy MySQL database, moved it to my new app's environment, and used the MySQL2 gem to build rake tasks to translate and move the data into my new app.

Tastypie, Django, MySQL permission denied error

I have setup a simple web service, when using just the python3 manage.py runserver it works fine, but when I deploy the application to Apache by using mod_wsgi it give the following error:
(2003, "Can't connect to MySQL server on 'localhost' ([Errno 13] Permission denied)")
I have also tried using the server's name and then the server's ip and it just replaces localhost in the error message.
Here is a copy of the XML when navigating to the page: http://pastebin.com/QtRzi0X6
Edit:
Also I would like to add that I am running on Fedora 20, Python3, Django 1.6, and MariaDB, Also I am use PyMySQL for django and python 3 so it can connect to MySQL
As it turns out (After hours of searching and testing), this is actually a apache/mod_wsgi problem, just type the following command to allow apache to make database connections:
setsebool -P httpd_can_network_connect_db 1

How do I make a connection to a MySQL database using ColdFusion?

I have Adobe ColdFusion 10 installed on my computer and registered with a free website on 000webhost.com. However, when I tried to connect I got this error:
Connection verification failed for data source: ssss
java.sql.SQLException: Timed out trying to establish connection The
root cause was that: java.sql.SQLException: Timed out trying to
establish connection
This is what I typed in the ColdFusion connector:
CF Data Source Name: ssss
Database: a9156701_25
Server: mysql3.000webhost.com Port 3306
Username: a9156701_sayood
Password: *******
I don't know if the problem is with the free web host or the way I added the data source.
Your datasource looks correct. You are not allowed to connect remotely to the database. I found this mentioned in their forums:
11-12-2013, 05:45 PM: Are you trying to connect remotely? (not
allowed) Your files have to be on the server.