测试mysql时发生了错误

来源:3-10 api之数据库层实现_编写User Test Case

sd1700092

2018-06-21

$ 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跑的时候出了这个问题~~?

写回答

4回答

helloei

2018-08-03

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

2
1
Ethreal
是正解
2019-04-21
共1条回复

阿章_香饽饽

2019-06-15

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

//img.mukewang.com/szimg/5d046f6e00010a1718260326.jpg

0
0

艾文西

2018-06-22

密码是不是配置有问题?

0
0

sd1700092

提问者

2018-06-21

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

//img.mukewang.com/szimg/5b2b6d18000191e307170410.jpg

0
2
sd1700092
回复
痞子过
还真不是,如果是密码问题那我命令行也连不上MYSQL了。。现在是命令行能连上,go程序连不上。。
2018-07-12
共2条回复

Go语言实战流媒体视频网站,高效学习Go高性能开发

从零开始,全面掌握Go语言编码的架构风格和开发Web的关键技能

996 学习 · 268 问题

查看课程