[Android-development] Unable to connect to MySQL
Samuel Gaist
samuel.gaist at edeltech.ch
Sun Jul 9 22:30:30 CEST 2017
> On 9 Jul 2017, at 15:50, Muhammad Bashir Al-Noimi <mbnoimi at gmail.com> wrote:
>
> On 07/09/2017 04:39 PM, Muhammad Bashir Al-Noimi wrote:
>> Hi,
>>
>> Using this Gist I could build MySQL plugin but unfortunately I unable to connect to any MySQL server.
>>
>> May you please help me to find out where is the problem?
>>
>> I'm using:
>> • Qt 5.9.1
>> • Qt Creator 4.3.1
>> • Linux Mint 18.2 x64 xfce
>> • Android API - 19
>> Can't connect to MySQL server on '192.168.1.7' (107) QMYSQL: Unable to connect
>>
>> MySQLClient.pro
>> QT += core gui sql
>>
>> greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
>>
>> TARGET = MySQLClient
>> TEMPLATE = app
>> DEFINES += QT_DEPRECATED_WARNINGS
>>
>> SOURCES += \
>> main.cpp \
>> mainwindow.cpp
>>
>> HEADERS += \
>> mainwindow.h
>>
>> FORMS += \
>> mainwindow.ui
>>
>> CONFIG += mobility
>> MOBILITY =
>>
>> DISTFILES += \
>> android/AndroidManifest.xml \
>> android/gradle/wrapper/gradle-wrapper.jar \
>> android/gradlew \
>> android/res/values/libs.xml \
>> android/build.gradle \
>> android/gradle/wrapper/gradle-wrapper.properties \
>> android/gradlew.bat
>>
>> ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
>>
>> contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
>> ANDROID_EXTRA_LIBS = \
>> /home/mbnoimi/Scripts/Shell/mysql_driver_qt/mariadb-connector-c-2.3.2-src/build/libmariadb/libmariadb.so \
>> $$PWD/../../../../.Qt/5.9.1/android_armv7/plugins/sqldrivers/libqsqlmysql.so
>> }
>>
>>
>> Connection snippet:
>> _db = QSqlDatabase::addDatabase("QMYSQL"
>> );
>> _db.setHostName(
>> "192.168.1.7"
>> );
>> _db.setPort(
>> "3306"
>> );
>> _db.setDatabaseName(
>> "db_account_76603915"
>> );
>> _db.setUserName(
>> "jassem"
>> );
>> _db.setPassword(
>> "123654789"
>> );
>>
>> if
>> (!_db.open()) {
>> ui->textEdit->append(_db.lastError().text());
>> }
>>
>>
>> IMPORTANT: I can connect to MySQL server through MySQL WorkBench using same parameters without any problem.
>>
>>
>> --
>> Best Regards,
>> Muhammad Bashir Al-Noimi
>> Skype+Telegram+GMail: mbnoimi
>>
> BTW, I posted this thread because I'm not sure what if this issue occurs because of a corrupted QMYSQL driver or something else.
> --
> Best Regards,
> Muhammad Bashir Al-Noimi
> Skype+Telegram+GMail: mbnoimi
>
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development
Hi,
Did you also configure your MySQL Server to accept external connection for that account ?
Is the port accessible ?
Also note that you should configure your connection to be secured.
Cheers,
Samuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20170709/175be3bc/attachment.sig>
More information about the Android-development
mailing list