The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Postgres Automatically Creates the Wrong Username

Discussion in 'Database Discussions' started by Mic1, Apr 1, 2015.

  1. Mic1

    Mic1 Member

    Joined:
    Feb 26, 2015
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Users can no longer access their Postgres databases using phpPgAdmin.

    Formerly when a new Postgres database was created in PostgreSQL Databases it automatically created a database such as "username_dbname" and a username such as "username". This worked well because phpPgAdmin uses "username" by default to allow the user to access all his databases.

    Now when a new database is created it creates a database such as "username_dbname" and the user that is automatically created with it is "username_dbname" as well. Since "username" doesn't have access to it by default, that newly-created database will not show up in phpPgAdmin.

    I think this is the change that started that:
    cPanel changelog from the 11.44.2.0 version:
    Fixed case 112133: DB Prefix missing in mySQL and Postgres UIs if cached.

    Is there a suggested fix for this?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you elaborate on how you are creating the PostgreSQL databases? You should create the databases through cPanel, create the user through cPanel, and then add the user to the database the same way you would for MySQL.

    Thank you.
     
  3. Mic1

    Mic1 Member

    Joined:
    Feb 26, 2015
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I'll give an example:

    In cPanel I go to PostgreSQL Databases and create a database name myuser_mydb
    At which point, via cli, I log into postgres and run a command to list all my databases/users: \l
    This shows:
    Name | Owner | Encoding | Collation | Ctype | Access privileges ----------------------------+-----------------+-----------+-------------+-------------+---------------------------------------myuser_mydb | myuser_mydb | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/myuser_mydb : myuser_mydb=CTc/myuser_mydb

    I have not yet created a user for this database, but it creates one automatically. I *can* create a user and assign it if I want, but phpPgAdmin uses the username 'myuser' to list the databases contained therein. So, by default, the username 'myuser' should be assigned to all phpPgAdmin databases and then, from there, I can create custom users, like myuser_pguser and add them, then a \l would show that user.

    To summarize, in order for phpPgAdmin to display all of my databases, I need all of them to have the owner 'myuser', which was default behavior. But now the owner is 'myuser_mydb'. I can go into the psql command-line and change the owner to 'myuser' which then causes it to show up in phpPgAdmin, but I want them to be created that way from the get-go as they once were.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  5. Mic1

    Mic1 Member

    Joined:
    Feb 26, 2015
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Ticket #6377373
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page