Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] use employees error, get dataset error 6: Unknown database 'employees' #595

Closed
dongzl opened this issue Jan 11, 2023 · 1 comment · Fixed by #618
Closed

[Bug] use employees error, get dataset error 6: Unknown database 'employees' #595

dongzl opened this issue Jan 11, 2023 · 1 comment · Fixed by #618
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dongzl
Copy link
Contributor

dongzl commented Jan 11, 2023

What would you like to be added:

Why is this needed:

Start arana, use this program connect to it error:

package sql

import (
	"database/sql"
	"fmt"
	_ "github.com/go-sql-driver/mysql"
	"log"
	"testing"
)

func TestName(t *testing.T) {
	mdb, err := sql.Open("mysql", "root:123456@tcp(127.0.0.1:13306)/employees?time_zone=%27Asia%2FShanghai%27&allowAllFiles=true")
	if err != nil {
		log.Fatalf("Open db err %v", err)
	}
	_, err1 := mdb.Exec("show tables")
	if err1 != nil {
		log.Fatalf("Exec show tables err %v", err1)
	}
	_, err2 := mdb.Exec(fmt.Sprintf("use `%s`", "employees"))
	if err2 != nil {
		log.Fatalf("Exec use db err %v", err2)
	}
}
2023-01-11T10:31:47.077+0800    ERROR   mysql/execute_handle.go:102     get dataset error 6: Unknown database 'employees' (errno 1049) (sqlstate 42000)
@dongzl dongzl added the bug Something isn't working label Jan 11, 2023
@dongzl dongzl added this to the 0.2.0 milestone Jan 11, 2023
@wang1309
Copy link
Contributor

原因:协议头为 ComQuery 类型,使用终端执行这条命令协议头为:ComInitDB。由于协议头为 ComQuery,导致请求直接被透传到 mysql 实例。
解决方案:待定

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants