Connecting to LightSail with MySQL Connector ODBC

0

I am using a Ubuntu image on Lightsail, and created a mariaDB database for my LAMP application. However, I am getting an error when trying to use MySQL Connector/ODBC to connect to the database from my Windows 10 laptop.

[MySQL][ODBC 8.0(w) Driver] Can't connect to MySQL server on '(IP address)' (10060).

My concern is that the LightSail console (database tab) says I don't have any databases. Yet, I have already created that mariaDB database and restored a mysqldump and the database is working just fine.

Do I need to recreate my database somehow, or register my existing database with the LightSail Console/Database tab somehow?

To connect Filezilla to my Lightsail instance, I had to use the security keys. Do I have to use them now?

Thank you in advance.
Zoomiest

Edited by: zoomiest on Jun 15, 2019 3:33 AM

Edited by: zoomiest on Jun 15, 2019 3:34 AM

Edited by: zoomiest on Jun 15, 2019 3:35 AM

已提問 5 年前檢視次數 269 次
4 個答案
0

Where did you create the schema? In your Ubuntu instance mariaDB server or in a Lightsail managed database?

If the database tab in Lightsail says there are no databases, then you don't have a managed database.

If you created the schema in your Ubuntu instance, then you'll need to open port 3306 for the instance in order to connect.

profile picture
David G
已回答 5 年前
0

Thank you, David. I have opened port 3306 using the Security interface in LightSail.

I see an error made in my questions. The error message is actually 10061, instead of 10060.

So, I am still not connecting. Still getting:

[MySQL][ODBC 8.0(w) Driver] Can't connect to MySQL server on (IP Address) (10061):

.

When I do a netstat, MySQL seems to be listening on 3306, but I don't know about those zeros for an IP...

ubuntu@host:/$ netstat -plutn
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::80                   :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -                   
udp        0      0 127.0.0.53:53           0.0.0.0:*                           -                   
udp        0      0 172.26.6.174:68         0.0.0.0:*                           -

Further, I went into MySQL and granted privileges from any IP address... (less secure, I know)

# GRANT ALL ON database.* TO 'user'@'%' IDENTIFIED BY 'password';

Any thoughts? I continue to wonder about the AWS Lightsail platform, as i am unfamiliar with it... Any platform-specific hurdles I am missing?

已回答 5 年前
0
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -
      ```

The netstat output identifies the problem.

You have the database server configured to listen on 127.0.0.1, which means it will only listen to clients running on that machine.

You'll need to change your /etc/my.cnf file ...

[mysqld]
bind-address    = 0.0.0.0

Also, if the my.cnf file shows 'skip-networking', comment that out.

david

profile picture
David G
已回答 5 年前
0

THANK YOU DAVID!
We are in, now!

已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南