<html><head><style type="text/css">body {word-wrap: break-word; background-color:#ffffff;}</style></head><body><div style="font-family: sans-serif; font-size: 16px">Richard,<br>Thanks! That was exactly the information I needed. <br><br>Now to figure out how to merge layers...<br><br>Thom<br><br><font face="sans-serif"><span style="font-size: 14px"><i><font color="#333333">Sent via DROID on Verizon Wireless</font></i></span></font></div><br><br>-----Original message-----<br><blockquote style="; border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: sans-serif; font-size: 14px"><b>From: </b>Richard Chirgwin <rchirgwin@ozemail.com.au><b><br>To: </b>grass-user@lists.osgeo.org<b><br>Sent: </b>2010 Sep, Thu, 23 07:20:51 GMT+00:00<b><br>Subject: </b>Re: [GRASS-user] Connecting GRASS to a MySQL database?<br><br></div> On 23/09/10 5:13 PM, grass-user-request@lists.osgeo.org wrote:<br>> Message: 3<br>> Date: Wed, 22 Sep 2010 16:51:08 -0400 (EDT)<br>> From: PixelPusher<pixelpusher@cox.net><br>> Subject: [GRASS-user] Connecting GRASS to a MySQL database?<br>> To:grass-user@lists.osgeo.org<br>> Message-ID:<cbcc5e.5f72.12b3b36ce33.Webtop.0@cox.net><br>> Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=no<br>><br>> Sorry for the n00bish question, but I'm confused by the GRASS on-line<br>> docs.<br>><br>> I have a MySQL database running on my local computer. Let's say that the<br>> MySQL user name is TRD and he has access to a database called TRD where<br>> I want to store my StateBoundaries table.<br>><br>> I can start the GRASS (6.4.0) Python interface and select<br>> "Database->Manage Databases->Connect" from the pulldown menu. I am then<br>> faced with the choice of driver, where I select "mysql". But, then it<br>> needs the Database name. This is where I get lost. The string in the<br>> text field says, "$GISDBASE/$LOCATION_NAME/$MAPSET/TRD". I'm not sure<br>> where GRASS is getting the values that substitute for those things that<br>> look like script variables. I guess the "$LOCATION_NAME" and "$MAPSET"<br>> come from the location and mapset that I selected when GRASS started.<br>> But, where is "$GISDBASE" set?<br>><br>> I also step through the log in process by setting the appropriate user<br>> name and password. I know that I can use this combination to access the<br>> MySQL database through its command line interface.<br>><br>> The next thing I do is try to test the connection. However, this results<br>> in lots of errors like, "Cannot connect to MySQL, Access denied for<br>> user" and "ERROR: Unable to open database<br>> <$GISDBASE/$LOCATION_NAME/$MAPSET/TRD>". It looks like GRASS is not<br>> using the right username and password and not doing the variable<br>> substitution that I was expecting.<br>><br>> Can anoyone give me some hints on how to get this thing started?<br>><br>> Thanks!<br>> Thom<br>Thom,<br><br>Having taught a few people how to use Grass-GIS, I can say that database parameters confuse a great many of them!<br><br>The parameters you see are for the default dbf driver (Grass-GIS uses this driver as the default for any new mapset). For MySQL, you provide the database location, and also login.<br><br>So where you see the $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ string, you want:<br>database=host=<ip address>,dbname=TRD<br><br>But you'll also have to login. Eg (command line):<br><br>db.login user=TRD password="somepassword"<br><br>(the inverted commas are needed at the command line but not using the GUI)<br><br>Notes:<br><br>1. From now on, every map you make in this particular mapset will use the MySQL database as its default connection. Don't try to mix different database drivers within a mapset - you'll get a headache!<br><br>2. Database parameters are stored only within the mapset you're using. If you want to connect a different mapset to MySQL, you have to set its connection.<br><br>Richard Chirgwin<br>_______________________________________________<br>grass-user mailing list<br>grass-user@lists.osgeo.org<br><a href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></body></html>