vanZeben / HelpTicket

6 stars 5 forks source link

"SQLException: Access denied for user 'minecraft'@'localhost' (using password: YES)", but credentials work otherwise #5

Closed FabianN closed 12 years ago

FabianN commented 12 years ago

I am trying to install and setup your plugin but it seems like the MySQL password is getting rejected.

2012-02-05 13:17:59 [INFO] [HelpTicket] Loading HelpTicket v1.6.
2012-02-05 13:17:59 [INFO] [HelpTicket] Using: Mail
2012-02-05 13:17:59 [INFO] SQLException: Access denied for user 'minecraft'@'localhost' (using password: YES)
2012-02-05 13:17:59 [INFO] SQLState: 28000
2012-02-05 13:17:59 [INFO] VendorError: 1045
2012-02-05 13:17:59 [SEVERE] Error occurred while enabling HelpTicket v1.6 (Is it up to date?): [HelpTicket] Failed to create connection to Mysql database
com.avaje.ebeaninternal.server.lib.sql.DataSourceException: [HelpTicket] Failed to create connection to Mysql database
    at com.imdeity.helpticket.db.MySQLConnector.<init>(MySQLConnector.java:34)
    at com.imdeity.helpticket.HelpTicket.loadDatabase(HelpTicket.java:87)
    at com.imdeity.helpticket.HelpTicket.onEnable(HelpTicket.java:41)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:231)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:1057)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:379)
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:191)
    at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:174)
    at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:357)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:344)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:175)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:408)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:465)

Thing is, I have confirmed that the login credentials work. The same login info works for other plugins, it works for command-line connection from the local machine, works for remote connection, and works via phpmyadmin. Only for this one plugin does it not work (Oh, and also your mail plugin seems to have the same issue, but that seems to be dependent of the HelpTicket plugin working in the first place).

I even tried giving the plugin the root login credentials to see what would happen, same error.

I have a handful of other plugins already working off of MySQL. I don't understand why this one wouldn't, unless maybe you are not parsing characters correctly. The minecraft MySQL pass has these characters: Upper-case letters, lower-case letters, numbers, &, %

JadedDragoon commented 12 years ago

Try placing your password in single quotes in the config file. I've had this problem with several plugins so far... placing the password (or username as the case my be) in single quotes almost always fixes it.

The yaml spec. allows you to leave out the single quotes and it will try to figure out what data type you want... however sometimes, depending on implementation, it will treat something as an integer when it should be a string. passwords with numbers in them are particularly prone to this. In fact the yaml spec states you should always use single quotes with strings... even though not using them works... most of the time.

Also yaml has a fair amount of special characters (one of them being %)... but if you place the string in question inside single quotes it will treat them as plain ascii characters.

FabianN commented 12 years ago

I place the info in single quotes, but after loading the plugin the single quotes are stripped from the config file.

Example of what I save:


help_ticket:
  notify_delay: 20
  min_word_count: 3
mysql:
  server:
    address: localhost
    port: 3306
    database:
      name: 'minecraft'
  database:
    username: 'minecraft'
    password: 'password'
    table_prefix: 'helpticket_'
    name: 'minecraft'

And after loading the server it changes to this:


help_ticket:
  notify_delay: 20
  min_word_count: 3
mysql:
  server:
    address: localhost
    port: 3306
    database:
      name: minecraft
  database:
    username: minecraft
    password: password
    table_prefix: helpticket_
    name: minecraft

And I still get the exact same error as before. :(

vanZeben commented 12 years ago

Escaping the characters with single quotes as jadeddragoon said will work on 1.6, just tested it myself. If your password does not contain any "special" characters and you escape it, the quotes will be removed, however if your password contains something like '%!pass123@!' or any other combination of special characters, the quotes will stay. Also just for your information the node 'mysql.server.database.name' is not needed, you can remove it. Its the same as 'mysql.database.name' i just made a typo.

Mail however was using the old method of a yaml file so thats been update, check if you can load mail without this issue

FabianN commented 12 years ago

I ended up changing the password and now it works. I had updated to 1.6, and I had reset the config files. I am guessing that one (or both) of these symbols was causing an issue: & %