Question
A database exists in a database server, but is absent in Plesk at Domains > example.com > Databases.
How to register an existing database in Plesk?
Answer
Below are common examples of registering existing databases.
To see all available commands for registering existing databases, see:
-
For Linux:
Reference for Command-Line Utilities, Plesk for Linux: database -
For Windows:
Reference for Command-Line Utilities, Plesk for Microsoft Windows: database.exe
-
Connect to a Plesk server via SSH.
-
List all database servers registered in Plesk:
# plesk db "SELECT host,port FROM DatabaseServers"
An output will be like this:
+-------------+------+
| host | port |
+-------------+------+
| 203.0.113.2 | 3306 |
| localhost | 3306 |
| localhost | 5432 |
+-------------+------+ -
Register a database in Plesk and add it to the subscription database pool:
# plesk bin database --register db_name -domain example.com -server 203.0.113.2:3306
where:
- db_name - database name
- example.com - name of the subscription to which the database is going to be attached
- 203.0.113.2 - name of the registered database server from step 2
- 3306 - MySQL port number
-
Register an existing database user with the command:
# plesk bin database --register-dbuser db_user -domain example.com -database db_name -user-role readWrite -passwd '<password>' -server 203.0.113.2:3306
where:
- db_user - database username
- example.com - subscription name specified on step 3
- db_name - database name specified on step 3
- <password> - password of the database user
- 203.0.113.2 - name of a registered database server from step 2
- 3306 - MySQL port number
-
Connect to a Plesk server via <a href="https://plesk…