10-create-connection.td 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. > CREATE SECRET mysqlpass AS '${arg.mysql-root-password}'
  10. #
  11. # Validate feature-flag
  12. #
  13. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  14. ALTER SYSTEM SET max_mysql_connections = 0
  15. ! CREATE CONNECTION mysq TO MYSQL (
  16. HOST mysql,
  17. USER root,
  18. PASSWORD SECRET mysqlpass
  19. )
  20. contains:creating MySQL Connection would violate max_mysql_connections limit (desired: 1, limit: 0, current: 0)
  21. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  22. ALTER SYSTEM SET max_mysql_connections = 1000
  23. #
  24. # Success create
  25. #
  26. > CREATE CONNECTION mysq TO MYSQL (
  27. HOST mysql,
  28. USER root,
  29. PASSWORD SECRET mysqlpass
  30. )
  31. > SELECT name, type from mz_connections WHERE id LIKE 'u%'
  32. name type
  33. ------------------------------
  34. mysq mysql
  35. >[version>=14000] SHOW CREATE CONNECTION mysq
  36. name create_sql
  37. ---------------------------------
  38. materialize.public.mysq "CREATE CONNECTION materialize.public.mysq TO MYSQL (HOST = mysql, PASSWORD = SECRET materialize.public.mysqlpass, USER = root);"
  39. >[version<14000] SHOW CREATE CONNECTION mysq
  40. name create_sql
  41. ---------------------------------
  42. materialize.public.mysq "CREATE CONNECTION \"materialize\".\"public\".\"mysq\" TO MYSQL (HOST = \"mysql\", PASSWORD = SECRET \"materialize\".\"public\".\"mysqlpass\", USER = \"root\")"
  43. #
  44. # Error checking
  45. #
  46. ! CREATE CONNECTION no_such_host TO MYSQL (
  47. HOST 'no_such_mysql.mtrlz.com',
  48. USER root,
  49. PASSWORD SECRET mysqlpass
  50. )
  51. contains:failed to lookup address information
  52. ! CREATE CONNECTION no_such_port TO MYSQL (
  53. HOST mysql,
  54. PORT 65534,
  55. USER root,
  56. PASSWORD SECRET mysqlpass
  57. )
  58. contains:Connection refused
  59. > CREATE SECRET badpass AS 'badpass'
  60. ! CREATE CONNECTION no_such_password TO MYSQL (
  61. HOST mysql,
  62. USER root,
  63. PASSWORD SECRET badpass
  64. )
  65. contains:Access denied for user 'root'