Hello! I've built the Qt Driver for Mysql and it works fine, when I log into localhost mysql is working and ready but whenever I try to access a remote mysql over the network (not local) it gives me an error, even though I have the credentials to connect (I can test it via mysql console) here's a code snippet about my connection information, if you have some time plz look it up
Database::Database()
{
db.setHostName("66.23.54.32"); // fake ip ;)
db.setPort(3306);
db.setDatabaseName("stephan");
db.setUserName("root");
db.setPassword("root");
db.open();
}
void Database::openConnection(){
if (!db.open())
db.lastError().text());
}
else qDebug()<<"SUCCESS";
}
return db;
}
Database::Database()
{
db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("66.23.54.32"); // fake ip ;)
db.setPort(3306);
db.setDatabaseName("stephan");
db.setUserName("root");
db.setPassword("root");
db.open();
}
void Database::openConnection(){
if (!db.open())
{ QMessageBox::critical(0,QObject::tr("Database Error"),
db.lastError().text());
}
else qDebug()<<"SUCCESS";
}
QSqlDatabase Database::getDb(){
return db;
}
To copy to clipboard, switch view to plain text mode
much appreciated
Bookmarks