stingray
15th August 2013, 19:56
Well, now im at it again...
i've got a server suppling MySQL, its version if it matters 5.5.32-0ubuntu0.13.04.1
i've got Qt 5.1.0 with MySQL driver built for Linux built from source on the ubuntu machine, as the supplied libqmysql.so or what its name is wasn't working, so i have built new one and its working... but now when i want to open the connection i get this qDebug message..
Error: "Access denied for user '<masked username>'@'localhost' (using password: YES) QMYSQL: Unable to connect"
the fun part is i copied and paste both user and pass from the phpmyadmin page, and stored it in my QSettings dialog.
i've tried password 4.1+ and password 4.0 standards in mysql (thu phpmyadmin), but it seems it doesnt like any of it.
the user host is % so it should work from localhost, without explictly saying localhost?
and port is 3306 as should be.
and in my /var/log/mysql/error.log
130815 20:24:15 [Warning] Access denied for user '<masked username>'@'localhost' (using password: YES)
and the code for this function...
void options::create_db_tables() {
QSettings Settings;
Settings.beginGroup("MySQL");
QString Host = Settings.value("MySQL_Host").toString();
int Port = Settings.value("MySQL_Port").toInt();
QString User = Settings.value("MySQL_User").toString();
QString Pass = Settings.value("MySQL_Pass").toString();
QString DB = Settings.value("MySQL_DB").toString();
Settings.endGroup();
QSqlDatabase MySQL_DB = QSqlDatabase::addDatabase("QMYSQL");
//MySQL_DB.addDatabase("QMYSQL");
MySQL_DB.setHostName(Host);
MySQL_DB.setPort(Port);
MySQL_DB.setUserName(User);
MySQL_DB.setPassword(Pass);
MySQL_DB.setDatabaseName(DB);
MySQL_DB.setConnectOptions();
if (MySQL_DB.open())
{
QSqlQuery DB_Query;
QString tmp_sql = "CREATE DATABASE :DB";
DB_Query.prepare(tmp_sql);
DB_Query.bindValue(":DB", DB);
DB_Query.exec();
}
else
{
qDebug() << "Error: " << MySQL_DB.lastError().text();
}
}
and the data in those variables are the ones enterd in the setupform that saves to qsettings, so they should be alright..
the things i can think of that could be wrong, is if the QMYSQL doesnt encrypt the password right without some db.setConnectOptions(); and
that the server thinks its a pre-encrypted password and a plaintext one comes along, well sure its right that it should not let the connection in.. hehe..
but i cant find anything in the doc about how a mysql .setConnectOptions(); is supposed to look like exept for how to use mysql and ssl, but if i cant connect to begin with the ssl doesnt do much help...
or well i cant find much on how a MySQL connection setup should look like when it works, most of the mysql threads and google is about "driver not loaded" stuff..
i've got a server suppling MySQL, its version if it matters 5.5.32-0ubuntu0.13.04.1
i've got Qt 5.1.0 with MySQL driver built for Linux built from source on the ubuntu machine, as the supplied libqmysql.so or what its name is wasn't working, so i have built new one and its working... but now when i want to open the connection i get this qDebug message..
Error: "Access denied for user '<masked username>'@'localhost' (using password: YES) QMYSQL: Unable to connect"
the fun part is i copied and paste both user and pass from the phpmyadmin page, and stored it in my QSettings dialog.
i've tried password 4.1+ and password 4.0 standards in mysql (thu phpmyadmin), but it seems it doesnt like any of it.
the user host is % so it should work from localhost, without explictly saying localhost?
and port is 3306 as should be.
and in my /var/log/mysql/error.log
130815 20:24:15 [Warning] Access denied for user '<masked username>'@'localhost' (using password: YES)
and the code for this function...
void options::create_db_tables() {
QSettings Settings;
Settings.beginGroup("MySQL");
QString Host = Settings.value("MySQL_Host").toString();
int Port = Settings.value("MySQL_Port").toInt();
QString User = Settings.value("MySQL_User").toString();
QString Pass = Settings.value("MySQL_Pass").toString();
QString DB = Settings.value("MySQL_DB").toString();
Settings.endGroup();
QSqlDatabase MySQL_DB = QSqlDatabase::addDatabase("QMYSQL");
//MySQL_DB.addDatabase("QMYSQL");
MySQL_DB.setHostName(Host);
MySQL_DB.setPort(Port);
MySQL_DB.setUserName(User);
MySQL_DB.setPassword(Pass);
MySQL_DB.setDatabaseName(DB);
MySQL_DB.setConnectOptions();
if (MySQL_DB.open())
{
QSqlQuery DB_Query;
QString tmp_sql = "CREATE DATABASE :DB";
DB_Query.prepare(tmp_sql);
DB_Query.bindValue(":DB", DB);
DB_Query.exec();
}
else
{
qDebug() << "Error: " << MySQL_DB.lastError().text();
}
}
and the data in those variables are the ones enterd in the setupform that saves to qsettings, so they should be alright..
the things i can think of that could be wrong, is if the QMYSQL doesnt encrypt the password right without some db.setConnectOptions(); and
that the server thinks its a pre-encrypted password and a plaintext one comes along, well sure its right that it should not let the connection in.. hehe..
but i cant find anything in the doc about how a mysql .setConnectOptions(); is supposed to look like exept for how to use mysql and ssl, but if i cant connect to begin with the ssl doesnt do much help...
or well i cant find much on how a MySQL connection setup should look like when it works, most of the mysql threads and google is about "driver not loaded" stuff..