How Can I Connect To MySql from client Computer?(Connect to Remote MysqL)
-
hi,
i want to connect to Mysql from another PC .
Both of System have Fedora linux version 15.0. -
thanks jake.
but i mean that connect to mysql server from another client on another pc. -
That's what that example does.
Take a look at "QSqlDatabase":http://qt-project.org/doc/qt-4.8/QSqlDatabase.html class and "here":http://qt-project.org/doc/qt-4.8/sql-connecting.htmlBut you probably have access to Google search engine as I have ;) .
-
ok you right.
i wrote code but give me under error:
can't connect to Mysql server on 'Server ip address' (113)
thanks a lot -
It's hard to suggest anything without code.
But check username, password and port. Check if the port is open to ( telnet command for example).Here is a short example for establishing connection:
@// db is QSqlDatabase
db = QSqlDatabase::addDatabase(DB_DRIVER); // example QMYSQL, QSQLITE, ...
db.setHostName("localhost"); // or IP
db.setPort(3306); // Default port is 3306
db.setUserName(dbUser); // example root
db.setPassword(dbPassword);
db.setDatabaseName(dbName);if(!db.open())
QMessageBox::warning(this, "Error", "NO CONNECTION");@For connecting to mySQL database, you'll need to compile QMYSQL driver ( everything is written on already provided link, but again, it's "here":http://doc.qt.nokia.com/4.7-snapshot/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows).
But just for testing connection, you can use QSQLITE. Should work. It did at least for me. -
[quote author="alireza.shirazi" date="1331049139"]ok you right.
i wrote code but give me under error:
can't connect to Mysql server on 'Server ip address' (113)
thanks a lot[/quote]Did you replace "Server ip address" with the actual address (hostname or IP address)?