Mysql access denied for user "root"@"localhost" (using password: NO) when running go run main.go
P粉121447292
P粉121447292 2023-08-29 19:34:50
0
1
542
<p>I'm trying to run a dedicated server on my computer, but MySQL (I believe) is giving me an error requiring a password. </p> <p>I'm trying to figure out the Unity dedicated server suite, </p> <p>https://www.gamevanillawiki.com/ccg-kit/manual/dedicated-server-kit/</p> <p>I figured out all the steps except the last one, which obviously means I should run "go run main.go", but if I run it I get the error in the title, </ p> <p>C:\ccg-kit-dedicated-server\dsk>go run main.go Error 2023/03/22 17:50:32 main.go:46: Error 1045: Access denied for user "root"@"localhost" (using password: NO) Exit status 1</p> <p>The developer of the suite said the error is related to MySQL and won't help me, I don't know how to fix this, when I run MySQL from the workbench with the password entered, the server is running but it's like Go Trying to access Mysql server without password or something? </p> <p>I can't even access MySQL from cmd, I even added it to my environment variables but it always gives me an unknown command error. </p> <p>Does anyone know how to solve this problem? Sorry, my knowledge of MySQL, Go and such servers is limited... I'm ready to throw in the towel and convert the project to Photon, but the problem is there's a lot of code that needs to be changed from Mirror to Photon .</p>
P粉121447292
P粉121447292

reply all(1)
P粉436052364

This page in the documentation (https://www.gamevanillawiki.com/dedicated-server-kit/demo-setup/) shows the config.json you should edit Example.

One of the lines in the configuration file is as follows:

"db_connection_string": "root:@tcp(127.0.0.1:3306)/dsk",

Go typically uses a database connection string format that follows this format (reference: https://github.com/go-sql-driver/mysql#dsn-data-source-name):

<username>:<password>@<protocol>(<address>:<port>)/<schemaname>

The example shown in the documentation page only shows root: for the username and password. So their sample database connection string doesn't have a password.

You need to edit this config.json file, specify your MySQL user and add that user's password between : and @.

The protocol, address and port are probably correct. If you are running the database on a different server than the one running your Go application, change the IP address.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template