Connect to MySQL from a Remote PC

Tabla de contenidos

Artículos relacionados

A few days ago, one of my bosses asked if he could manage the company’s database using MS Access, since it’s the only tool he’s truly comfortable with for running queries, creating forms, and generating reports. He convinced me, so I started researching how to do it. I came across a post on desarrolloweb explaining how to connect to MySQL via ODBC using Access’s “linked tables” feature. It sounded like a dream setup, but like everything else, there was a catch: it only works if you can actually establish a connection to MySQL.

Initially, the local connection was a breeze; the real headache started when I tried connecting to the server. What follows is the saga of “How to remotely connect to MySQL installed on Mandriva.”

While configuring the ODBC, I kept getting connection errors like “The server is not responding.” My first thought was, “It’s the firewall,” so I opened port 3306 (the default MySQL port). The error persisted. After a day of scouring the web and banging my head against the wall, thinking I couldn’t even manage to open a simple port, I discovered that my MySQL server wasn’t listening on port 3306 at all. In fact, it wasn’t listening on any port.

Another day and several searches later, I realized this was because the service was starting with the --skip-networking option. Naturally, I thought, “Easy, I’ll just edit my.cnf.” Every website I found suggested the same thing: “Just comment out the skip-networking line and you’re good to go.” But what do you do when that line isn’t even in the configuration file?

Thanks to the MySQL documentation, I checked how the service was being launched:

ps xa | grep mysqld

There it was. I could see that MySQL was being launched with the skip-networking flag, even though my config file suggested otherwise. I searched the web further, but no one had an answer. Finally, I decided to open /etc/init.d/mysqld-max to dig into what the script was actually doing. That’s where I found that the script calls a file located at /etc/sysconfig/mysqld, and that was where the infamous skip-networking line was hiding.

I finally commented it out and successfully established the ODBC connection. Who would have thought a simple ODBC connection would take so much time? At least it gave me something to write about here…