密码Clickhouse驱动程序中的#

I use this driver

how to send a password? If it is difficult "Dsd0@E)0#jsdpAS)DJD!)d0@*d"

  connect, err := sql.Open("clickhouse", "tcp://127.0.0.1:9000?username=default&password=Dsd0@*E)0#jsdpAS)DJD*!)d0@*d&database=database&read_timeout=10&write_timeout=20")

they correct but get error "[193] Wrong password for user default "

The second parameter is a URL (in this context often called a DSN), so you have to URL-encode the parameter, unsurprisingly.

Use the url.URL and url.Values types to build the URL in a robust way:

q := make(url.Values)
q.Set("username", "default")
q.Set("password", `Dsd0@*E)0#jsdpAS)DJD*!)d0@*d`)
q.Set("database", "database")
q.Set("read_timeout", "10")
q.Set("write_timeout", "20")

dsn := (&url.URL{
    Scheme:   "tcp",
    Host:     "127.0.0.1:9000",
    RawQuery: q.Encode(),
}).String()

connect, err := sql.Open("clickhouse", dsn)

Now go and change your password!