1grass-mysql(1)              GRASS GIS User's Manual             grass-mysql(1)
2
3
4

MySQL DATABASE DRIVER

6       MySQL database driver enables GRASS to store vector attributes in MySQL
7       server.
8
9       Because vector attribute tables are created automatically  when  a  new
10       vector  is written and the name of the table is the same as the name of
11       the vector it is good practice to create a new database for each  GRASS
12       mapset.
13

Creating a MySQL database

15       A new database is created within MySQL:
16       mysql> CREATE DATABASE mydb;
17       See the MySQL manual for details.
18

Driver and database name

20       GRASS  modules  require  2  parameters to connect to a database.  Those
21       parameters are ’driver’ and ’database’. For MySQL driver the  parameter
22       ’driver’  should be set to value ’mysql’.  The parameter ’database’ can
23       be given in two formats:
24
25           ·   Database name - in case of connection from localhost
26
27           ·   String of comma separated list of kye=value options.  Supported
28               options are:
29
30               ·   dbname - database name
31
32               ·   host - host name or IP address
33
34               ·   port - server port number
35       Examples of connection parameters:
36         db.connect driver=mysql database=mytest
37         db.connect driver=mysql database=’dbname=mytest,host=test.grass.org’
38

Data types

40       GRASS supports almost all MySQL data types with following limitations:
41
42           ·   Binary  columns (BINARY, VARBINARY, TINYBLOB, MEDIUMBLOB, BLOB,
43               LONGBLOB) are not not supported.  If a table with  binary  col‐
44               umn(s)  is used in GRASS a warning is printed and only the sup‐
45               ported columns are returned in query results.
46
47           ·   Columns of type SET and ENUM are represented  as  string  (VAR‐
48               CHAR).
49
50           ·   Very  large  integers  in columns of type BIGINT can be lost or
51               corrupted because GRASS does not support 64  bin  integeres  on
52               most platforms.
53
54           ·   GRASS  does not currently distinguish types TIMESTAMP and DATE‐
55               TIME. Both types are in GRASS interpreted as TIMESTAMP.
56

Indexes

58       GRASS modules automatically  create  index  on  key  column  of  vector
59       attributes  table. The index on key column is important for performance
60       of modules which update  the  attribute  table,  for  example  v.to.db,
61       v.distance and v.what.rast.
62

Privileges

64       Because  MySQL  does not support groups of users and because only MySQL
65       ’root’ can grant privileges to other users GRASS  cannot  automatically
66       grant select privileges on created tables to group of users.
67
68       If  you  want  to give privilege to read data from your mapset to other
69       users you have to ask your MySQL server administrator to  grant  select
70       privilege to them on the MySQL database used for that mapset. For exam‐
71       ple, to allow  everybody to read data in from your database ’mydb’:
72       shell> mysql --user=root mysql
73       mysql> GRANT SELECT ON mydb.* TO ’’@’%’;
74

Schemas

76       Because MySQL does not support database schemas the parameter  ’schema’
77       of  module db.connect should never be set to any value. If you set that
78       parameter for MySQL driver GRASS will try to write tables to the speci‐
79       fied schema which will result in errors.
80

Groups

82       MySQL  does  not support user groups. Any settings specified by ’group’
83       parameter of module db.connect are ignored by GRASS for MySQL driver.
84

Troubleshooting: SQL syntax error

86       Attempting to use a reserved SQL word as  column  or  table  name  will
87       result  in  a  "SQL syntax" error. The list of reserved words for MySQL
88       can be found in the MySQL manual.
89

SEE ALSO

91        db.connect, SQL support in GRASS GIS
92

Credits

94       Development of the driver was sponsored by Faunalia (Italy) as part  of
95       a project for ATAC.
96

AUTHOR

98       Radim Blazek
99
100       Main  index  |  Topics  index | Keywords index | Graphical index | Full
101       index
102
103       © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
104
105
106
107GRASS 7.8.5                                                     grass-mysql(1)
Impressum