Skip to main content
Clarification from comments
Source Link
Chris Davies
  • 128.4k
  • 16
  • 179
  • 324

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector with the connection stringstrings 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?

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector with the connection string tcp://localhost: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?

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector 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?

Information from comments copied to the question where it can be easily seen by everyone. Again.
Source Link
Chris Davies
  • 128.4k
  • 16
  • 179
  • 324

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector with the connection string tcp://localhost: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?

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector. 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?

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector with the connection string tcp://localhost: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?

Information from comments copied to the question where it can be easily seen by everyone
Source Link
Chris Davies
  • 128.4k
  • 16
  • 179
  • 324

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector. 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.

Is there some configuration that I forgot to change? What does the "(2)" mean?

Edit (more information):

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?

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector. 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.

Is there some configuration that I forgot to change? What does the "(2)" mean?

Edit (more information):

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".

Trying to connect to a database with a c++ program. I am using the mysqlcppconnector. 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?

added 171 characters in body
Source Link
Taylor
  • 133
  • 7
Loading
Source Link
Taylor
  • 133
  • 7
Loading