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.

Automatically create database

Discussion in 'General Discussion' started by ruber, Feb 8, 2008.

  1. ruber

    ruber Member

    Joined:
    Jun 5, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Is possible to create automatically a MySQL database when I create an account on WHM? I want to add a MySQL database to all new clients of a specific package.
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    You can create a file called '/scripts/postwwwacct' which will automatically run after a user account is created. In that script you may want to run a mysql statement to create the database. You can find some sample code here:

    http://www.cpanel.net/support/docs/hooks.htm#postwww

    And then sneak in a 'CREATE DATABASE $user_dbname' command.
     
Loading...

Share This Page