Answer» Just a quick tip: If you are trying to access a MySQL Server remotely (from another machine, say- for example, using the .NET DBConnector on a desktop while using a existing MySQL Install on the laptop) consider the fact that MySQL ships by default so that it doesn't allow remote connections.
Basically, I had everything setup and coded, but I couldn't get it to log on to the database. Finding out how to make MySQL accessible remotely wasn't easy either, I kept finding stuff that told me to edit logs that didn't exist.
For the record, if you want to make a MySQL Server accessible remotely on Ubuntu or a derivative thereof (in my case, mint) Edit the file (as root) /etc/mysql/my.cnf, and within the file look for and comment out the line
Code: [Select]bind-address = 127.0.0.1 comments being Hashmarks (#) at the start, btw.
In total I spent about 12 hours total (it's coming up on 6PM, I've been up since... 5AM working on this) converting my .NET database layer from using Access databases to using MySQL. 10 minutes to actually make the required code changes and configuration changes to it''s INI file, about an hour thinking my code was broken, giving up on munging around with it, trying to figure out why MySQL wasn't showing up in a netstat as listening on port 3306, learning through google that it doesn't by default allow remote connections, googling to figure out how to make it accept remote connections, trying to follow tutorials for ancient versions of red hat that try to get me to open files either without giving me a folder- "open your my.cnf file" they say, yes, I would have done that if I knew where it was..., finally finding one that was more modern but still decided that I only needed a filename to find the log file, searching the drive for the file (my.cnf) in question, finding about a half dozen, learning through more googles that there is a special precedence to the my.cnf files and if I edit the wrong one it won't do anything, learning about said precedence Finally making the change, stumbling while trying to restart mysql because I wasn't doing it as root, GOING back to my desktop and my application and trying to undo all the changes I made when I thought the code was wrong, and finally getting it working.
I swear when I was Stepping over the code in the debugger and I got to the line where it establishes the connection (an otherwise innocent looking "CacheCon.Open()" call) the 8 or so seconds it took to establish the connection and succeed felt like an eternity of waiting for what I felt was an inevitable error leading to another sidetrack to googleville. I thought I was dreaming as that line not only worked flawlessly but all my other code and SQL statements didn't throw errors and seemed to do exactly what they were intended to do.
So that's been my day, anyway.Yup, been burnt by this one myself!I have to admit it was fulfilling to watch all my otherwise untested code work perfectly fine and do exactly what I wanted it to. Well, OK, that's a lie, I did have to change a query referring to a field I named "Order" to be in backticks since ORDER is a SQL reserved word.
This "project" really is a bunch of firsts. First actual paid Job in this field, first go at a "real" WPF application, first time using databases from .NET, and first time accessing a remote database in a "distributed" idea (admin and client app on separate machines seeing each others changes) first time using MySQL outside PHP, first time dealing with my own MySQL installation (rather than on a webhost), first time dealing with the UI concern that a touchscreen (and no keyboard) brings to the table. And so on. First time writing a serious "Tiered" application (Client (touchscreen) and Admin applet both use the same DataLayer library which abstracts away most database related tasks), etc. A project of firsts. I've learned more about the involved technologies(WPF, MySQL, MySQL Server administration and ADO.NET) than I probably would have learned "at my leisure" in the next year. Feels good to work on something for hours on end, learning new technologies, and having something that (IMO) looks pretty damned professional. On an unrelated note I've had to use my laptop for a lot more of the network facing stuff, so I've had to use FTP to upload things to my site for the last week or so, to the point where It's second nature (and I've memorized the randomly generated password for my webhost), Control-Alt-Arrow to switch between desktops for checking E-Mail and so forth, running MYSQLDUMP to get a overview of my database schema to refer to while working on new functionality in the desktop apps, etc.Are you developing in VISUAL Studio? Can that not handle all the FTP uploads for you?
Quote from: Rob Pomeroy on December 19, 2011, 02:44:50 AM Are you developing in Visual Studio? Can that not handle all the FTP uploads for you?
The applications I speak of are not web-applications, but client-side programs; my website is PHP/MySQL, running on a webhost. Normally, I would work on my site using Editpad Pro's FTP Panel, which makes dealing with FTP pretty much automatic. The reason I've had to start using the ftp shell on my linux machine is that my only Internet access currently is through wireless and my Wireless-N PCI card appears to have given up the ghost, so my desktop has no internet connection, (I tried learning how to bridge the connections via the laptop but gave up). ftp is still quite workable and in many ways faster to work with, so it's not a huge change. Although now my laptop is tethered to the desktop via a crossover cable for both my own MySQL dev server as well as data transfers through Samba in both directions .
Quote from: BC_Programmer on December 17, 2011, 07:02:08 PMconsider the fact that MySQL ships by default so that it doesn't allow remote connections.
Sounds just like SendMail. You wouldn't believe how long I bitched and screamed at my old linux server when I couldn't receive any email on my server from the outside. SendMail by default just works locally on the machine until you change the config to allow it to receive email from the outside world.In MySQL's case, having it configured that way by default makes more sense, since one of the most common use cases is that the MySQL Server is in fact the same machine that is running apache, so it basically "connects" to itself,so allowing remote connections would just be opening an attack surface. I just found that, even after I knew that was the default setup, I had to do so much googling just to find out how to change it, and it was a bit frustrating.
But it's working quite flawlessly now.
Quote from: BC_Programmer on December 19, 2011, 07:03:09 AMeven after I knew that was the default setup, I had to do so much googling just to find out how to change it, and it was a bit frustrating.
Ditto when I setup SendMail the 1st time. I had one of those huge 3 inch hard cover SendMail books and I couldn't find the answer in their. Then spent a few days Google Searching and finally figured out how to change the SendMail config file. Was literally one line of code to change. I completely understand why MySQL and Sendmail would be configured out of the box like that. It is probably a huge security hole if you don't have your server or Network locked down. You certainly wouldn't want to have an Open Relay setup on your Mail server by accident.Hindsight is wonderful, isn't it! "telnet aaa.bbb.ccc.ddd 25" (from a remote machine) is our friend.
|