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.

postwwwacct - set privleges on new database

Discussion in 'cPanel Developers' started by willsmelser, Dec 16, 2009.

  1. willsmelser

    willsmelser Member

    Joined:
    Jun 11, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I was able to use the hook script:
    without a problem.

    In my script I create and populate a couple of databases (via php) with:
    PHP:
    shell_exec('mysql < /path/to/mydbs.sql');
    However, I need to access the
    on localhost to set premissions so the databases will be available for new user. I cannot use
    PHP:
    mysql_connect('localhost','root','pass');
    The connection fails. I cannot see how to do this via PHP. I am looking at Bash right now. Just rather have it all working in one language.

    NOTE:
     
  2. willsmelser

    willsmelser Member

    Joined:
    Jun 11, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Solution using command line

    well, Ive been messing with this for hours when I finally posted, and of course minutes later I got a command line solution.

    user the '-e' parameter
    I should be able to roll that into the php shell_exec() method.

    NOTE:This will work when logged in as root. Look at -u, -p or --user=, --pass= for non root implamentation.
     
Loading...

Share This Page