grass-mysql.html 4.0 KB

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