从某些应用程序,我无法连接到远程数据库服务器:
MYSQL conn;
if(!mysql_init(&conn))
std::wcout << "Error: can't create MySQL-descriptor" << endl;
if(!mysql_real_connect(&conn,"ip","user","password","dbname",0,0,0))
std::wcout << "Error: can't connect to MySQL server" << endl;
if(mysql_query(&conn, "SELECT VERSION()") != 0)
std::wcout << "Error: can't execute SQL-query" << endl;
3306
我在远程服务器上打开了端口:
iptables -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
iptables save
iptables restart
错误:
无法连接到数据库:错误:无法连接到“ip_..”上的 MySQL 服务器 (10060)
可能是什么原因?