Limmek / MStats-for-rust

Logs player statistics and other server stuff to MySql
https://buymeacoffee.com/Limmek
5 stars 3 forks source link

Error on Load and reload #10

Closed clumsyzombie closed 4 years ago

clumsyzombie commented 4 years ago

Strange error even tough I set the DB and Table details it is still looking for mstats for something on reload of the plugin. 06-30 22:37:52 | MySql handle raised an exception in 'MStats v1.5.3' plugin (MySqlException: Access denied for user 'rust4559874'@'%' to database 'mstats') at MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery (System.IAsyncResult asyncResult) [0x00022] in <8d7380b3d3cf4bd8be324c584f371b44>:0 at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery(System.IAsyncResult) at Oxide.Core.MySql.Libraries.MySql+MySqlQuery.Handle () [0x000f2] in <79d157ef50864cd6a493ea45b8d9c402>:0

My host is forcing me to use a random DB name and looks like it doesn't like my DB name as it keeps trying to look for mstats.

Config file details { "_AdminLog": false, "_AdminLogWords": "admin, mod, fuck", "_LogAridrops": false, "_LogChat": false, "_LogConsole": false, "_LogServerbradleyapc": false, "_LogServerCargoship": false, "_LogServerch47": false, "_LogServerPatrolhelicopter": false, "_MySQL": true, "Database": "rust4559874", "Host": "you_would_like_to_know", "Password": "you_would_like_to_know", "Port": 3306, "Username": "you_would_like_to_know", "Version": "1.5.3" }

I removed the host and password and username for this post BTW didn't want the details getting out but I have stuff in the spots.

clumsyzombie commented 4 years ago

06-30 22:44:22 | Loaded plugin MStats v1.5.3 by Limmek 06-30 22:44:22 | 06-30 22:44:22 | MySql handle raised an exception in 'MStats v1.5.3' plugin (MySqlException: Access denied for user 'rust4559874'@'%' to database 'mstats') at MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery (System.IAsyncResult asyncResult) [0x00022] in <8d7380b3d3cf4bd8be324c584f371b44>:0 at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery(System.IAsyncResult) at Oxide.Core.MySql.Libraries.MySql+MySqlQuery.Handle () [0x000f2] in <79d157ef50864cd6a493ea45b8d9c402>:0

Limmek commented 4 years ago

Hmm strange, i can connect to "Database": "test123456", just fine. I did create a new database with charset utf8 and collation utf8_bin, then changed mstats config the the new database name "test123456" and reloaded the plugin.

One thing i noticed in your error is that the database name is used as username when trying to connect to the database and it still trying to connect to mstats. 'rust4559874'@'%' to database 'mstats' should be 'USERNAME'@'%' to database 'rust4559874'

What DB do you use? I use MySQL 5.7.

clumsyzombie commented 4 years ago

Correct the Login and DB name is the same. This is going to sound bad I am not 100% what they are using it is the game server host that is running it for us gtxgaming. I am seeing if they give me that detail. Server version: 5.6.42-log - MySQL Community Server (GPL) So I am given a DB based on on the login name also. So my DB is rust4559874 and that is the login also then I have the tables. The read is covering IP address. Sorry Also it is putting content into the DB right now even with the error.

image image

image

Limmek commented 4 years ago

This is very weird, the setup is just fine and it seems that it is working as expected?

I did fire up my old rust server and tried some different configurations and i can not replicate the errors. I did try MySQL and MariaDB, both localhost and remote connection to another server and everything is working just fine.

Can you open MStats.cs in any texteditor comment out row 81 Chagne executeQuery("CREATE DATABASE IF NOT EXISTS mstats"); to //executeQuery("CREATE DATABASE IF NOT EXISTS mstats"); or just remove it.

Then it wont try to force add mstats if it not exit. I should probably add a config option to the force database creation so you can disable it when using hosting provides that do not allow self named BD's to be created.

clumsyzombie commented 4 years ago

image I didn't get the message any more in the console

image

Limmek commented 4 years ago

Okey great! I will add a feature to enable/disable the force of database creation then 😄