Login to an existing database as a database superuser or a user
who has CREATEROLE and CREATEDB privileges, then execute the following
command:
psql.exe -h <HOST-NAME> -W -U
<USER_NAME> -p <PORT> -d <DATABASE_NAME>
-- Delete previous user if needed
--
DROP USER "MM";
-- If the user cannot be
dropped due to any ownership issues, you'll need to reassign those objects to
another user
-- REASSIGN OWNED BY "MM" TO
<OTHER-USER-NAME>;
-- Or drop those objects
-- DROP OWNED BY "MM"
--
Create a user MM with LOGIN privilege
CREATE USER "MM"
LOGIN PASSWORD 'MM123!';
-- Create a database
MM with UTF8 encoding.
CREATE DATABASE "MM" WITH OWNER
"MM" ENCODING 'UTF8';
Note: For maintenance reasons, PostgreSQL database indexes can be rebuilt as follows:
o Stop the MM Tomcat server
o run the following command
under the MS-DOS command prompt assuming postgresql/bin is in the system path. This may take some
time if your database is large.
reindexdb --username=MM
--dbname=MM -v
o Restart the MM Tomcat server
For more information on reindexdb, refer to the PostgreSQL documentation.