mcorega / MySqlSwiftNative

MySQL Swift Native Driver
Other
112 stars 44 forks source link

The operation couldn’t be completed. (MySQLDriver.Socket.SocketError error 3.) #45

Open Casual3306 opened 2 years ago

Casual3306 commented 2 years ago

I'm sort of new to Swift programming and I have been experimenting with certain aspects but, whenever I try to use this module to connect (code below):

import MySQLDriver

...

let user = "User"
let pass = "Test Pass"
let host = "<IP ADDRESS OF HOST>"

let connect = MySQL.Connection()

print("++ Attempting to connect to: \(host) - \(user)")

do {
    try connect.open(host, user: user, passwd: pass)

} catch (let e) {
    // Display an error message here stating that the connection was unsuccessful
    self.displayMessageAlert(title: "Login Error", message: "Could not login to \(host) using username \(user)"); print(e.localizedDescription); return
}

I get this message (localized): The operation couldn’t be completed. (MySQLDriver.Socket.SocketError error 3.) I don't know what is wrong as the everything should be set up properly, the connection is set and stable (both devices are on the same network), the test user exists. The database service is started and running.

Also, in the info.plist the App Transport Security -> Allow Arbitrary Loads is set to YES.