Setting Up Remote Database Hosting
If you are going to use a Plesk-managed server as a remote database server, you do not need to install MySQL software: Plesk comes with MySQL software, which is automatically installed during installation of Plesk. In this case, you only need to enable network access to this database server and then register it with Plesk.
To set up a MySQL database server:
- Copy to your server a MySQL distribution package from your operating system distribution disk, or download it from www.mysql.com site and save it on your server.
- Log in as root to your server and change to the directory where you saved the RPM distribution. Type the following command at the prompt:
rpm -ivh
mysql_file_name.rpm
- Set the database server administrator's password. Type the following command at the prompt:
mysqladmin -u root password your_desired_password
Change your_desired_password to anything you like.
- Now proceed to the instructions on registering your database server with Plesk.
To set up a PostgreSQL database server:
- Copy to your server a PostgreSQL distribution package from your operating system distribution disk, or download it from www.postgresql.org site and save it on your server.
- Log in as root to the server where you want to host databases, and change to the directory where you saved the distribution package.
- Install the package in a way suitable for your operating system.
- For RPM based Linux systems, type the following command at the prompt:
rpm -ivh postgresql_file_name.rpm
- For deb package based Linux systems, issue the command:
apt-get install package_name
- For FreeBSD systems, to install from a package, issue the following command:
pkg_add pgsql-<version>.tgz
- To install from ports, issue the following commands:
cd /usr/ports/databases/postgresql<version>-server
make install package clean
- Open the file
/var/lib/pgsql/data/postgresql.conf
with a text editor. If you are installing PostgreSQL version earlier than 8, add the line tcpip_socket = true
to this file. If you are installing PostgreSQL version later than 8, add the line listen_addresses = '*'
. - Open the file
/var/lib/pgsql/data/pg_hba.conf
with a text editor and make sure the following lines are there:# local DATABASE USER METHOD [OPTION]
local samegroup all password
# host DATABASE USER IP-ADDRESS IP-MASK METHOD [OPTION]
host samegroup all 0.0.0.0 0.0.0.0 md5
- To restart PostgreSQL, issue the following command at the prompt:
service postgresql restart
- To set the database server administrator's password, issue the following commands at the prompt (change 'your_desired_password' to anything you like):
psql -d template1 -U postgres
alter user postgres with password 'your_desired_password';
- Now proceed to the instructions on registering your database server with Plesk.
To register a database server with Plesk:
- Log in to Plesk.
- Click the Server shortcut in the navigation pane.
- Click the Database Servers icon in the Services group.
- Click the Add Database Server icon in the Tools group.
- Specify the properties of the database server:
- Specify hostname or IP address of the database server.
- Specify the port number the database server is listening on. By default, MySQL servers listen on port 3306, and PostgreSQL on port 5342. You can leave the Port number box blank, if your database server is listening on the default port.
- Specify which database type is running on the database server.
- To make this database server default for hosting customers' databases, select the check box labeled Use this server as default for MySQL. If you have a PostgreSQL database server, select the check box labeled Use this server as default for PostgreSQL.
- Specify the database server administrator's login name and password.
- Click OK.
To set up database hosting preferences that will affect all databases created through Plesk:
- Go to Server > Database Servers > Preferences.
- To simplify maintenance of customers' databases, select the Add client's login name and underscore to beginning of database names check box. All names of newly created databases will look like client's login name_database name. This will allow you to locate databases related to a particular Plesk user. Note that even if you do not select this check box, on creation of a new database, Plesk will add client's login name to the database name input box, and you will be able to edit it or remove it.
- You can also set up Plesk to add client's login names to corresponding database user names, further simplifying the maintenance of customers' databases. To do so, select the Add client's login name and underscore to the beginning of database user names check box. All names of newly created database users will look like client's login name_database user name. This will allow you to locate database users related to a particular Plesk user.
- Specify whether creation of databases is allowed on your Plesk server. Some applications do not support remote databases and can work only with databases hosted on the same server. We recommend leaving the default option Allow local hosting of databases for these site applications selected, otherwise, you will not be able to use such applications.
- Click OK.