grass-mysql.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>GRASS-MySQL driver</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <link rel="stylesheet" href="grassdocs.css" type="text/css">
  7. </head>
  8. <body bgcolor="white">
  9. <img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
  10. <h1>MySQL driver in GRASS</h1>
  11. MySQL database driver in GRASS enables GRASS to store vector
  12. attributes in MySQL server.
  13. <p>
  14. Because vector attribute tables
  15. are created automaticaly when a new vector is written and the
  16. name of the table is the same as the name of the vector it is
  17. good practice to create a new database for each GRASS mapset.
  18. <H2>Creating a MySQL database</H2>
  19. A new database is created within MySQL:
  20. <div class="code"><pre>
  21. mysql> CREATE DATABASE mydb;
  22. </pre></div>
  23. See the MySQL manual for details.
  24. <h2>Driver and database name</h2>
  25. GRASS modules require 2 parameters to connect to a database.
  26. Those parameters are 'driver' and 'database'. For MySQL driver
  27. the parameter 'driver' should be set to value 'mysql'.
  28. The parameter 'database' can be given in two formats:
  29. <ul>
  30. <li> Database name - in case of connection from localhost
  31. <li> String of comma separated list of kye=value options.
  32. Supported options are:
  33. <ul>
  34. <li> dbname - database name
  35. <li> host - host name or IP address
  36. <li> port - server port number
  37. </ul>
  38. </ul>
  39. Examples of connection parameters:
  40. <pre>
  41. db.connect driver=mysql database=mytest
  42. db.connect driver=mysql database='dbname=mytest,host=test.grass.org'
  43. </pre>
  44. <h2>Data types</h2>
  45. GRASS supports almost all MySQL data types with following limitations:
  46. <ul>
  47. <li> Binary columns (BINARY, VARBINARY, TINYBLOB, MEDIUMBLOB,
  48. BLOB, LONGBLOB) are not not supported.
  49. If a table with binary column(s) is used in GRASS
  50. a warning is printed and only the supported columns are
  51. returned in query results.
  52. <li> Columns of type SET and ENUM are represented as string (VARCHAR).
  53. <li> Very large integers in columns of type BIGINT can be lost
  54. or corrupted because GRASS does not support 64 bin integeres
  55. on most platforms.
  56. <li> GRASS does not currently distinguish types TIMESTAMP and
  57. DATETIME. Both types are in GRASS interpreted as TIMESTAMP.
  58. </ul>
  59. <h2>Indexes</h2>
  60. GRASS modules automaticaly create index on key column of vector
  61. attributes table. The index on key column is important
  62. for performance of modules which update the attribute table,
  63. for example v.to.db, v.distance and v.what.rast.
  64. <h2>Privileges</h2>
  65. Because MySQL does not support groups of users and because
  66. only MySQL 'root' can grant privileges to other users
  67. GRASS cannot automaticaly grant select privileges on created
  68. tables to group of users.
  69. <p>
  70. If you want to give privilege to read data from your mapset
  71. to other users you have to ask your MySQL server administrator
  72. to grant select privilege to them on the MySQL database used
  73. for that mapset. For example, to allow everybody to read data
  74. in from your database 'mydb':<br>
  75. <pre>
  76. shell&gt; mysql --user=root mysql
  77. mysql&gt; GRANT SELECT ON mydb.* TO ''@'%';
  78. </pre>
  79. <h2>Schemas</h2>
  80. Because MySQL does not support database schemas the parameter
  81. 'schema' of module db.connect should never be set to any
  82. value. If you set that parameter for MySQL driver GRASS will
  83. try to write tables to the specified schema which will result
  84. in errors.
  85. <h2>Groups</h2>
  86. MySQL does not support user groups. Any settings specified
  87. by 'group' parameter of module db.connect are ignored by
  88. GRASS for MySQL driver.
  89. <h2>SEE ALSO</h2>
  90. <em>
  91. <a HREF="db.connect.html">db.connect</a>,
  92. <a HREF="sql.html">SQL support in GRASS GIS</a></em>
  93. <h2>Credits</h2>
  94. Development of the driver was sponsored by
  95. <a href="http://www.faunalia.it">Faunalia</a> (Italy)
  96. as part of a project for <a href="http://www.atac.roma.it/">ATAC</a>.
  97. <H2>AUTHOR</H2>
  98. Radim Blazek
  99. <p><i>Last changed: $Date$</i>
  100. <HR>
  101. <BR><a href=index.html>Help Index</a>
  102. </body>
  103. </html>