Web-based Change request management software
 
Q: With MySQL, at the step of "Creating Tables" during setup , I got
   java.sql.SQLException: Server connection failure during transaction.
   Attempted reconnect 3 times. Giving up.

A: This can happen for various reasons.

   1. First, your MySQL might have the TCP/IP networking disabled (some MySQL 
      distributions do that by default for security reasons).
      Since JDBC uses TCP/IP protocal, you must enable it.
      To see whether or not TCP/IP is enabled, you can do:

      $ netstat -ln |grep 3306
      tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN 

      (On Windows, use "netstat -na", and look for  0.0.0.0:3306)

      Or, 
      $ telnet localhost 3306
      Trying 127.0.0.1...
      Connected to localhost.
      Escape character is '^]'.

      The above shows that MySQL is listening on port 3306.
      TCP/IP can be disabled if you have the flag, "skip-networking", under the
      [mysqld] section of the my.cnf file, you need comment it out. If you do not want
      to expose your MySQL server to the network other than localhost, you can add the
      flag, "bind-address=127.0.0.1", under [mysqld].


   2. Secondly, you may have in-correct mysql user permissions.

   If the database user you entered is bugzero, and the database is bugzero_db
   (which has to be created before hand), then, you need have these two grants:

   mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP ON bugzero_db.*
          TO bugzero@"%" IDENTIFIED BY 'bugzero_password';
   
   mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP ON bugzero_db.* 
          TO bugzero@localhost IDENTIFIED BY 'bugzero_password';

   Here bugzero_password should be replaced by the real password.

   If you then connect as root and do
   mysql> select user,host,db from db;
   you will get something like:
	+---------+--------------+-------------+
	| user    | host         | db          |
	+---------+--------------+-------------+
	| bugzero | %            | bugzero_db  |
	| bugzero | localhost    | bugzero_db  |
	|         | %            | test        |
	|         | %            | test\_%     |
	+---------+--------------+-------------+

   mysql> select user,host from user;
   you will get something like:
	+---------+--------------+
	| user    | host         |
	+---------+--------------+
	| bugzero | %            |
	| bugzero | localhost    |
	| root    | localhost    |
	|         | hostname     |
	| root    | hostname     |
	+---------+--------------+

   Now, connect as user bugzero by:
   mysql -ubugzero -p
  
   If it connects, then, try:
   mysql> use bugzero_db;

   if Database changed, then you are set and you can re-run the Bugzero setup program.
 	
   If it still fails to connect, then, you may need add another grant:

   mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP ON bugzero_db.* 
          TO bugzero@hostname IDENTIFIED BY 'bugzero_password';

   Here, hostname should be replaced by the real hostname of the mysql server.


   3. There is yet another cause.
      Check your /etc/hosts and see whether or not you have something like:

      # special IPv6 addresses
      ::1             localhost ipv6-localhost ipv6-loopback

      If so, modify it to:
      ::1             ipv6-localhost ipv6-loopback


* Reference brought to you by Bugzero, it's more than just bug tracking software!

Home - FAQs