mysql database won't allow tcp connections on localhost at the default port
1
vote
1
answer
1197
views
Trying to connect to a database with a c++ program. I am using the [mysqlcppconnector](https://dev.mysql.com/downloads/connector/cpp/) with the connection strings
tcp://localhost:3306
and tcp://127.0.0.1:3306
. The program works on my local machine, but when I try to run it on my remote ubuntu server after ssh'ing in, it complains:
terminate called after throwing an instance of 'sql::SQLException'
what(): Unknown MySQL server host 'tcp' (2)
I'm just trying to connect on localhost, at the default port 3306. I can also connect manually by typing in mysql -u root -p
and just logging in that way.
After logging in to my database with mysql -u root -p
, I can type show variables;
and indeed I see skip-networking
set to "OFF".
MySQL is listening on the network:
netstat -a | grep mysql
tcp 0 0 localhost:mysql 0.0.0.0:* LISTEN
unix 2 [ ACC ] STREAM LISTENING 20025 /var/run/mysqld/mysqld.sock
Is there some configuration that I forgot to change? What does the "(2)" mean?
Asked by Taylor
(123 rep)
Oct 24, 2019, 03:34 PM
Last activity: Oct 25, 2019, 01:53 PM
Last activity: Oct 25, 2019, 01:53 PM