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.

Creating a database manually

Discussion in 'Database Discussions' started by flycast, Feb 20, 2011.

  1. flycast

    flycast Member

    Joined:
    Feb 20, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I have created a database using sql in a script. When I created the database I was logged in to the MySQL server as the user of the cPanel account. When I go to cPanel for that user and click on "MySQL Databases" the database does not show up in the list of databases.

    If I create a database and user while not using cPanel (through phpmyadmin or a script) what do I need to do to make sure that cPanel will list the databases and users and the owner of the account will be able to administer (use, change, delete, etc) the database and user through cPanel?
     
    #1 flycast, Feb 20, 2011
    Last edited: Feb 20, 2011
  2. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello,

    The databases created in the cPanel format i.e., cpanel user_databasename will only be listed in Cpanel of the domain. Can you make sure you have created in this format?
     
  3. flycast

    flycast Member

    Joined:
    Feb 20, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Yes. It was. I created two databases...one through cPanel and one through phpmyadmin. I thin logged into phpmyadmin as root and looked and both databases showed up in the following format:
     
  4. flycast

    flycast Member

    Joined:
    Feb 20, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Also, both databases showed up in phpmyadmin when logged in as cPanel user.
     
  5. flycast

    flycast Member

    Joined:
    Feb 20, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I just tried the same thing again. The database created in phpmyadmin does not show up in the cPanel listing even though the text in front of the underscore is the cPanel user.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You cannot use a script or PhpMyAdmin to create databases in this manner in 11.28 onward due to database mapping. Creating a database on a prefixed system will not have it show up in cPanel > MySQL Databases area if created in PhpMyAdmin due to the fact that it doesn't create the necessary yaml files in /var/cpanel/databases/ location to map the database to the user.

    You would need to use the API to create databases or otherwise have your script create the necessary mapping for that user with the dbmaptool script. You can use the following script to create a map to the database user:

     
  7. eva2000

    eva2000 Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    322
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Brisbane, Australia
    cPanel Access Level:
    Root Administrator
    Twitter:
    curious is bindbmaptool same as the WHM -> SQL Services -> Database Map Tool i see ?
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Correct, that would perform the same function in WHM using the Database Map Tool. Since the requester mentioned a script, I imagined it would be preferred to use the utility in root SSH over the WHM one.
     
  9. ! am bond

    ! am bond Guest

    Was creating DBs through script/ PHPMyadmin disabled?
     
  10. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    On prefixed systems, you can still create databases via PhpMyAdmin, but those databases will not appear in cPanel > MySQL Databases area due to the fact they aren't mapped properly in /var/cpanel/databases area to the user. As such, it is not advised to create databases through PhpMyAdmin on prefixed systems.

    On non-prefixed systems, PhpMyAdmin will display an error upon trying to create a database, so that option would not even be possible to perform.

    The option to create databases is still available via the API or if the script calls the dbmaptool function I mentioned to map the database to the user.
     
Loading...

Share This Page