请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

测试mysql时发生了错误

$ go test -v

[mysql] 2018/06/21 15:13:14 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:14 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

[mysql] 2018/06/21 15:13:15 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:15 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

[mysql] 2018/06/21 15:13:16 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:16 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

[mysql] 2018/06/21 15:13:17 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:17 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

=== RUN   TestUserWorkFlow

=== RUN   TestUserWorkFlow/Add

[mysql] 2018/06/21 15:13:18 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:18 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

=== RUN   TestUserWorkFlow/Get

[mysql] 2018/06/21 15:13:19 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:19 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

2018/06/21 15:13:19 Error 1045: Access denied for user 'root'@'localhost' (using password: YES)

=== RUN   TestUserWorkFlow/Del

[mysql] 2018/06/21 15:13:20 auth.go:293: unknown auth plugin:

[mysql] 2018/06/21 15:13:20 driver.go:113: could not use requested auth plugin '': this authentication plugin is not supported

2018/06/21 15:13:20 Delete user error: Error 1045: Access denied for user 'root'@'localhost' (using password: YES)

panic: runtime error: invalid memory address or nil pointer dereference [recovered]

        panic: runtime error: invalid memory address or nil pointer dereference

[signal 0xc0000005 code=0x0 addr=0x0 pc=0x59da81]


goroutine 72 [running]:

testing.tRunner.func1(0xc0421222d0)

        F:/Go/src/testing/testing.go:742 +0x2a4

panic(0x62cc00, 0x794e80)

        F:/Go/src/runtime/panic.go:505 +0x237

database/sql.(*Stmt).ExecContext(0x0, 0x69d1c0, 0xc04205a0e8, 0xc04203bf28, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)

        F:/Go/src/database/sql/sql.go:2224 +0x51

database/sql.(*Stmt).Exec(0x0, 0xc04203bf28, 0x2, 0x2, 0x1, 0xc0420cc260, 0xf, 0x77dc3f)

        F:/Go/src/database/sql/sql.go:2253 +0x6c

video_server/api/dbops.DeleteUser(0x67053f, 0x7, 0x66fbad, 0x3, 0x489d6d, 0x5b2b500f)

        F:/GoProjects/src/video_server/api/dbops/api.go:35 +0x194

video_server/api/dbops.testDeleteUser(0xc0421222d0)

        F:/GoProjects/src/video_server/api/dbops/api_test.go:44 +0x56

testing.tRunner(0xc0421222d0, 0x680848)

        F:/Go/src/testing/testing.go:777 +0xd7

created by testing.(*T).Run

        F:/Go/src/testing/testing.go:824 +0x2e7

exit status 2

FAIL    video_server/api/dbops  7.672s

mysql连接时报错,不过我试过用命令行连接mysql是可以的,也能运行select语句,不知道为什么用go test跑的时候出了这个问题~~?

正在回答 回答被采纳积分+3

4回答

helloei 2018-08-03 15:15:30

你密码写错了, 把密码后面对@#去掉

2 回复 有任何疑惑可以回复我~
  • Ethreal #1
    是正解
    回复 有任何疑惑可以回复我~ 2019-04-21 14:34:01
阿章_香饽饽 2019-06-15 12:09:22

是老师视频里写错了 应该去掉@#, 应该是

https://img1.sycdn.imooc.com//szimg/5d046f6e00010a1718260326.jpg

0 回复 有任何疑惑可以回复我~
艾文西 2018-06-22 21:33:23

密码是不是配置有问题?

0 回复 有任何疑惑可以回复我~
提问者 sd1700092 2018-06-21 17:17:15

我检查了我下的包,应该没问题,老师

https://img1.sycdn.imooc.com//szimg/5b2b6d18000191e307170410.jpg

0 回复 有任何疑惑可以回复我~
  • 2018/06/21 15:13:19 Error 1045: Access denied for user 'root'@'localhost' (using password: YES)
    
    应该是密码问题
    回复 有任何疑惑可以回复我~ 2018-07-11 09:04:34
  • 提问者 sd1700092 回复 痞子过 #2
    还真不是,如果是密码问题那我命令行也连不上MYSQL了。。现在是命令行能连上,go程序连不上。。
    回复 有任何疑惑可以回复我~ 2018-07-12 21:16:26
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信