MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / mysqlInitialized

Function mysqlInitialized

cmd/sqlc-test-setup/main.go:697–705  ·  view source on GitHub ↗

mysqlInitialized checks if the MySQL data directory has been initialized. We use sudo ls because /var/lib/mysql is typically only readable by the mysql user, so filepath.Glob from a non-root process would silently fail.

()

Source from the content-addressed store, hash-verified

695// We use sudo ls because /var/lib/mysql is typically only readable by the
696// mysql user, so filepath.Glob from a non-root process would silently fail.
697func mysqlInitialized() bool {
698 out, err := exec.Command("sudo", "ls", "/var/lib/mysql").CombinedOutput()
699 if err != nil {
700 return false
701 }
702 // If the directory has any contents, consider it initialized.
703 // mysqld --initialize-insecure requires an empty directory.
704 return strings.TrimSpace(string(out)) != ""
705}

Callers 1

startMySQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected