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.
6 replies
That’s what that example does.
Take a look at QSqlDatabase [qt-project.org] class and here [qt-project.org]
But you probably have access to Google search engine as I have ;) .
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.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())
For connecting to mySQL database, you’ll need to compile QMYSQL driver ( everything is written on already provided link, but again, it’s here [doc.qt.nokia.com]).
But just for testing connection, you can use QSQLITE. Should work. It did at least for me.
You must log in to post a reply. Not a member yet? Register here!



