path: root/doc/README.mysql
diff options
authorChristian Grothoff <>2010-08-25 19:10:18 +0000
committerChristian Grothoff <>2010-08-25 19:10:18 +0000
commit9aa22137e2427e1f44c7fca2f30005ba8b22195d (patch)
tree29ce98471d30a686c101ffff10b3461f7044491c /doc/README.mysql
parent073be523fd1121b2bb4cd2f77f3098b0c98c1738 (diff)
postgres hackery
Diffstat (limited to 'doc/README.mysql')
1 files changed, 95 insertions, 0 deletions
diff --git a/doc/README.mysql b/doc/README.mysql
new file mode 100644
index 000000000..e123c43ac
--- /dev/null
+++ b/doc/README.mysql
@@ -0,0 +1,95 @@
+How to setup the MySQL database for GNUnet.
+NOTE: This db module does NOT work with mysql before 4.1 since we need
+prepared statements. We are generally testing the code against MySQL
+5.0 at this point.
+ + On up-to-date hardware where mysql can be used comfortably, this
+ module will have better performance than the other db choices
+ (according to our tests).
+ + Its often possible to recover the mysql database from internal
+ inconsistencies. The other db choices do not support repair
+ (gnunet-check cannot fix problems internal to the dbmgr!).
+ For example, we have seen several cases where power failure
+ has ruined a gdbm database beyond repair.
+ + much faster (for one of the key benchmarks -- content migration
+ -- we have measure mysql taking 2s for an operation where
+ sqlite takes 150s).
+ - Memory usage (Comment: "I have 1G and it never caused me trouble")
+ - Manual setup
+ 1) in /etc/gnunet.conf, set
+ sqstore = "sqstore_mysql"
+ 2) Then access mysql as root,
+ $ mysql -u root -p
+ and do the following. [You should replace $USER with the username
+ that will be running the gnunetd process].
+ GRANT select,insert,update,delete,create,alter,drop,create temporary tables
+ ON gnunet.* TO $USER@localhost;
+ SET PASSWORD FOR $USER@localhost=PASSWORD('$the_password_you_like');
+ 3) In the $HOME directory of $USER, create a ".my.cnf" file
+ with the following lines
+ [client]
+ user=$USER
+ password=$the_password_you_like
+ Thats it. Note that .my.cnf file is a security risk unless its on
+ a safe partition etc. The $HOME/.my.cnf can of course be a symbolic
+ link. Even greater security risk can be achieved by setting no
+ password for $USER. Luckily $USER has only priviledges to mess
+ up GNUnet's tables, nothing else (unless you give him more,
+ of course).
+ 4) Still, perhaps you should briefly try if the DB connection
+ works. First, login as $USER. Then use,
+ $ mysql -u $USER
+ mysql> use gnunet;
+ If you get the message &quot;Database changed&quot; it probably works.
+ [If you get &quot;ERROR 2002: Can't connect to local MySQL server
+ through socket '/tmp/mysql.sock' (2)&quot; it may be resolvable by
+ &quot;ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock&quot;
+ so there may be some additional trouble depending on your mysql setup.]
+ 5) If you want to run the testcases, you must create a second
+ database "gnunetcheck" with the same username and password.
+ This database will then be used for testing ("make check").
+- Its probably healthy to check your tables for inconsistencies
+ every now and then, especially after system crashes.
+- If you get odd SEGVs on gnunetd startup, it might be that the mysql
+ databases have been corrupted.
+- The tables can be verified/fixed in two ways;
+ 1) by shutting down mysqld (mandatory!) and running
+ # myisamchk -r *.MYI
+ in /var/lib/mysql/gnunet/ (or wherever the tables are stored).
+ Another repair command is "mysqlcheck". The usable command
+ may depend on your mysql build/version. Or,
+ 2) by executing
+ mysql> REPAIR TABLE gn090;
+If you have problems related to the mysql module, your best friend is
+probably the mysql manual. The first thing to check is that mysql is
+basically operational, that you can connect to it, create tables,
+issue queries etc.