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
431

I'm trying to run a dedicated server on my computer, but MySQL (I believe) is giving me an error requiring a password.

I'm trying to figure out the Unity dedicated server suite,

https://www.gamevanillawiki.com/ccg-kit/manual/dedicated-server-kit/

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,

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

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?

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.

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粉121447292
P粉121447292

reply all (1)
P粉436052364

This page in the documentation (https://www.gamevanillawiki.com/dedicated-server-kit/demo-setup/) shows theconfig.jsonyou 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):

:@(
:)/

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

You need to edit thisconfig.jsonfile, 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
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!