ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB gocql driver Connecting to the cluster Authentication
For AI agents: a documentation index is available at https://gocql-driver.docs.scylladb.com/master/llms.txt. A Markdown version of this page is at https://gocql-driver.docs.scylladb.com/master/connecting/authentication.md.

AuthenticationΒΆ

Set ClusterConfig.Authenticator for credentials shared by all hosts:

cluster := gocql.NewCluster("db.example.com")
cluster.Authenticator = gocql.PasswordAuthenticator{
	Username: os.Getenv("SCYLLA_USERNAME"),
	Password: os.Getenv("SCYLLA_PASSWORD"),
}

Do not hard-code credentials in source control. Load them from a secret manager or another protected runtime source.

By default, PasswordAuthenticator accepts any authenticator class announced by the server. Restrict it when the expected server authenticator is known:

cluster.Authenticator = gocql.PasswordAuthenticator{
	Username: os.Getenv("SCYLLA_USERNAME"),
	Password: os.Getenv("SCYLLA_PASSWORD"),
	AllowedAuthenticators: []string{
		"org.apache.cassandra.auth.PasswordAuthenticator",
	},
}

Use ClusterConfig.AuthProvider when credentials or authentication logic vary by host. Authenticator and AuthProvider cannot both be set.

Authentication credentials are only protected in transit when TLS is enabled. See TLS.

Was this page helpful?

PREVIOUS
Compression
NEXT
TLS
  • Create an issue
  • Edit this page
ScyllaDB gocql driver
Search Ask AI
  • master
    • master
  • Quick start
  • Connecting to the cluster
    • Compression
    • Authentication
    • TLS
    • Client routes (PrivateLink / Private Service Connect)
  • Executing CQL statements
    • Paging
    • Batch statements
    • Lightweight transactions
    • Request timeouts
  • Data types
  • Load balancing
  • Retry policy configuration
  • Speculative execution
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 14 Sep 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3