从某些应用程序中,我无法连接到远程数据库服务器:
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错误:
未能连接到数据库:错误:无法连接到“MySQL .”上的ip_服务器(10060)
可能是什么原因?
https://stackoverflow.com/questions/12312239
复制相似问题