{"modulePath":"github.com/hostinger/api-cli","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package databases\n\n## Variables\n\n```go\nvar ChangePasswordCmd = \u0026cobra.Command{\n\tUse:   \"change-password \u003cusername\u003e \u003cname\u003e\",\n\tShort: \"Change database password\",\n\tLong:  \"Changes the password for the specified database user.\\n\\nThe database name must be the full name returned by the list databases endpoint.\\nThe password must also be updated in any website configuration that uses this database.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tpayload, err := json.Marshal(changePasswordBody(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr, err := api.Request().HostingChangeDatabasePasswordV1WithBodyWithResponse(context.TODO(), args[0], args[1], \"application/json\", bytes.NewReader(payload))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar CreateCmd = \u0026cobra.Command{\n\tUse:   \"create \u003cusername\u003e\",\n\tShort: \"Create account database\",\n\tLong:  \"Creates a database with a database user and password for the specified account.\\n\\nThe database name and user are automatically prefixed with the account username when needed.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tpayload, err := json.Marshal(createBody(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr, err := api.Request().HostingCreateAccountDatabaseV1WithBodyWithResponse(context.TODO(), args[0], \"application/json\", bytes.NewReader(payload))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar DeleteCmd = \u0026cobra.Command{\n\tUse:   \"delete \u003cusername\u003e \u003cname\u003e\",\n\tShort: \"Delete account database\",\n\tLong:  \"Permanently deletes a database and its remote connections.\\n\\nThe database name must be the full name returned by the list databases endpoint.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().HostingDeleteAccountDatabaseV1WithResponse(context.TODO(), args[0], args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar GroupCmd = \u0026cobra.Command{\n\tUse:   \"databases\",\n\tShort: \"Databases commands\",\n}\n```\n\n```go\nvar ListCmd = \u0026cobra.Command{\n\tUse:   \"list \u003cusername\u003e\",\n\tShort: \"List account databases\",\n\tLong:  \"Returns a paginated list of databases for the specified account.\\n\\nUse the domain and is_assigned filters to find databases assigned to a specific domain.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().HostingListAccountDatabasesV1WithResponse(context.TODO(), args[0], listParams(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar PhpmyadminLinkCmd = \u0026cobra.Command{\n\tUse:   \"phpmyadmin-link \u003cusername\u003e \u003cname\u003e\",\n\tShort: \"Get phpMyAdmin link\",\n\tLong:  \"Returns a direct sign-on link to phpMyAdmin for the specified database.\\n\\nUse this when a visual database interface is needed for SQL queries, imports, exports, or table management.\\nThe database name must be the full name returned by the list databases endpoint.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().HostingGetPhpMyAdminLinkV1WithResponse(context.TODO(), args[0], args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar RepairCmd = \u0026cobra.Command{\n\tUse:   \"repair \u003cusername\u003e \u003cname\u003e\",\n\tShort: \"Repair database\",\n\tLong:  \"Repairs corrupted database tables asynchronously.\\n\\nUse when database errors, crashes, or corruption are reported.\\nThe database name must be the full name returned by the list databases endpoint.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().HostingRepairDatabaseV1WithResponse(context.TODO(), args[0], args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n","path":"github.com/hostinger/api-cli/cmd/hosting/databases","name":"databases","synopsis":"","isRedistributable":true}
