Minecraft, MySQL, and plugins - Could not create connection

Post Reply
Rhythmatic
A regular
A regular
Posts: 31
Joined: Tue Feb 22, 2011 9:32 am

Minecraft, MySQL, and plugins - Could not create connection

Post by Rhythmatic » Sat Apr 09, 2011 8:18 am

I have a minecraft server that is running Recommended Build #617 of CraftBukkit. We have a ton of plugins installed already, but there are a few more that I need to add to wrap everything up. These three (iConomy, BigBrother, and NetStats) all require a database, with two of the three requiring MySQL. Well, I have MySQL set up on the server and running just fine, as I've gotten phpBB running without difficulty, however, each and everytime I start the server, I get the following bit in my error log.

Code: Select all

2011-04-09 05:01:29 [INFO] [iConomy] Could not create connection: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
2011-04-09 05:01:29 [INFO] [iConomy] Could not load transaction logger: 
2011-04-09 05:01:29 [SEVERE] java.lang.NullPointerException
2011-04-09 05:01:29 [SEVERE] 	at com.nijiko.coelho.iConomy.system.Transactions.load(Transactions.java:31)
2011-04-09 05:01:29 [SEVERE] 	at com.nijiko.coelho.iConomy.iConomy.onEnable(iConomy.java:138)
2011-04-09 05:01:29 [SEVERE] 	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:118)
2011-04-09 05:01:29 [SEVERE] 	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:514)
2011-04-09 05:01:29 [SEVERE] 	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:216)
2011-04-09 05:01:29 [SEVERE] 	at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:94)
2011-04-09 05:01:29 [SEVERE] 	at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:72)
2011-04-09 05:01:30 [SEVERE] 	at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:215)
2011-04-09 05:01:30 [SEVERE] 	at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:202)
2011-04-09 05:01:30 [SEVERE] 	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:142)
2011-04-09 05:01:30 [SEVERE] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:257)
2011-04-09 05:01:30 [SEVERE] 	at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
2011-04-09 05:01:30 [INFO] [iConomy] Could not create connection: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
2011-04-09 05:01:30 [INFO] [iConomy] Failed to load database: java.lang.NullPointerException
2011-04-09 05:01:30 [INFO] [iConomy] Plugin disabled.
All three use a java-mysql connector, and I've ensured that it's been downloaded and placed in the correct folder. I've also created a "minecraft" mysql user and made a "minecraft" database. I got the following YAML from phpMyAdmin.

Code: Select all

%YAML 1.1
---
# mysql.user
-
  Host: "localhost"
  User: "minecraft"
  Password: "BLANKED FOR SECURITY"
  Select_priv: "N"
  Insert_priv: "N"
  Update_priv: "N"
  Delete_priv: "N"
  Create_priv: "N"
  Drop_priv: "N"
  Reload_priv: "N"
  Shutdown_priv: "N"
  Process_priv: "N"
  File_priv: "N"
  Grant_priv: "N"
  References_priv: "N"
  Index_priv: "N"
  Alter_priv: "N"
  Show_db_priv: "N"
  Super_priv: "N"
  Create_tmp_table_priv: "N"
  Lock_tables_priv: "N"
  Execute_priv: "N"
  Repl_slave_priv: "N"
  Repl_client_priv: "N"
  Create_view_priv: "N"
  Show_view_priv: "N"
  Create_routine_priv: "N"
  Alter_routine_priv: "N"
  Create_user_priv: "N"
  Event_priv: "N"
  Trigger_priv: "N"
  ssl_type: ""
  ssl_cipher: ""
  x509_issuer: ""
  x509_subject: ""
  max_questions: 0
  max_updates: 0
  max_connections: 0
  max_user_connections: 0
I can plainly see that my three newly created users don't have privs, even though I did a

Code: Select all

GRANT ALL PRIVILEGES ON minecraft.* TO "minecraft"@"localhost";
So what did I do wrong? This is the only thing I can think of.

Rhythmatic
A regular
A regular
Posts: 31
Joined: Tue Feb 22, 2011 9:32 am

Re: Minecraft, MySQL, and plugins - Could not create connect

Post by Rhythmatic » Sat Apr 09, 2011 8:20 am

Also, this.

Code: Select all

# Netstats Error Log
CraftBukkit Version: git-Bukkit-0.0.0-612-g4c7a9e7-b617jnks (MC: 1.4)
Netstats Version: b3.9.1
MySQL Error: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
Offending Statement: UPDATE netstats SET logged=0

User avatar
Edge100x
Founder
Founder
Posts: 12309
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Minecraft, MySQL, and plugins - Could not create connect

Post by Edge100x » Sat Apr 09, 2011 9:54 am

Global privileges are separate from individual database privileges. Your command would give the "minecraft" user full database privileges.

Did you also define a password for the "minecraft" user, with a separate command? Are you able to connect and administer its database using phpMyAdmin and that login and password?

Beyond that, I am not sure what to try, as I'm just not familiar with using MySQL from Java.

Rhythmatic
A regular
A regular
Posts: 31
Joined: Tue Feb 22, 2011 9:32 am

Re: Minecraft, MySQL, and plugins - Could not create connect

Post by Rhythmatic » Sat Apr 09, 2011 10:03 am

I just logged in (for the third time) with the "minecraft" username and noticed that it says "Create new database: NO PRIVILEGES". What the hell? I thought I gave it privs. What do I need to do to fix this?

User avatar
Edge100x
Founder
Founder
Posts: 12309
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Minecraft, MySQL, and plugins - Could not create connect

Post by Edge100x » Sat Apr 09, 2011 10:08 am

As I mentioned, a user can have individual database privileges, or global privileges, or a mix. You gave your user all privileges on a particular database, so "minecraft" can add tables, update tables, etc, all within that database. Creating a new database is, by contrast, a global privilege. You did not grant your user that ability, and it shouldn't need it.

Rhythmatic
A regular
A regular
Posts: 31
Joined: Tue Feb 22, 2011 9:32 am

Re: Minecraft, MySQL, and plugins - Could not create connect

Post by Rhythmatic » Sat Apr 09, 2011 10:10 am

Right. That makes sense. I think the big, scary red text just got my blood boiling, cause that should have been obvious. I just tried adding a table, and it worked. :\

Are there any queries that I can try in the MySQL CLI client that could simulate what the plugins are trying to do? Perhaps narrow down the possible cause?

User avatar
Edge100x
Founder
Founder
Posts: 12309
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Minecraft, MySQL, and plugins - Could not create connect

Post by Edge100x » Sat Apr 09, 2011 10:12 am

It's difficult to say, as that error isn't giving us any real information. Presumably "communications failure" could mean many things.

Post Reply