Cannot access MySQL running on another machine
-
Hello,
I've been trying to connect to a local server (NOT localhost). No matter what I do the connection always fails and I'm uncertain why.
However, it is possible to connect to it using other tools that utilize a TCP/IP connection.
I was wondering if there's a solution or TCP driver available for Qt somewhere?QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName(ip); db.setPort(3306); db.setUserName(user_name); db.setPassword(pw); db.setDatabaseName(db_name); if(db.open()) { QMessageBox::information(this, "Connection Status", "Connection Successful!"); query = new QSqlTableModel(); query->setQuery(ui->lineEdit_query->text()); ui->tableView->setModel(query); qDebug() << db.userName(); } else { QMessageBox::information(this, "Connection Status", "Connection Failed!\n" + db.hostName() + ":" + QString::number(db.port())); qDebug() << db.lastError(); }
qDebug has been throwing an Access denied error. So I assume there must have been a sort of communication between the MySQL server and my application.
Meanwhile I get this error: ```
QSqlError("1129", "QMYSQL: Unable to connect", "Host '10.141.***' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'") -
@SnuggleKat said in Cannot access MySQL running on another machine:
"Host '10.141.***' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'")
You will first need to do what the error suggests to be able to connect.
Do you use exact same data (user name, password, ip, port) to connect as you do when using other tools? -
Are you able to use something like MySQL Workbench and connect to your server instance from your remote machine?
-
@MrShawn said in Cannot access MySQL running on another machine:
Are you able to use something like MySQL Workbench and connect to your server instance from your remote machine?
Yes. Tried some setting in the my.cnf. Looks like skip-networking solved the problem
-
@SnuggleKat said in Cannot access MySQL running on another machine:
Looks like skip-networking solved the problem
Could you describe what this skip-networking concept is? for the sake of completeness and benefit of documenting the case for other future users having the same issue.
And if your issue is solved, please don't forget to mark your post as such. Thanks