()
| 683 | } |
| 684 | |
| 685 | func verifyMySQL() error { |
| 686 | log.Println("verifying mysql connection") |
| 687 | if err := run("mysql", "-h", "127.0.0.1", "-u", "root", "-pmysecretpassword", "-e", "SELECT VERSION();"); err != nil { |
| 688 | return fmt.Errorf("mysql connection test failed: %w", err) |
| 689 | } |
| 690 | log.Println("mysql is running and configured") |
| 691 | return nil |
| 692 | } |
| 693 | |
| 694 | // mysqlInitialized checks if the MySQL data directory has been initialized. |
| 695 | // We use sudo ls because /var/lib/mysql is typically only readable by the |