Jump to:

4873 Posts in 7260 Topics by 1471 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Error: C:\inetpub\wwwroot\silverstripe\sapphire\core\model\MySQLDatabase.php:

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3122 Views
  • tom12010
    Avatar
    Community Member
    2 Posts

    Error: C:\inetpub\wwwroot\silverstripe\sapphire\core\model\MySQLDatabase.php: Link to this post

    Tried 3 timesinstalling with WebPI to Windows 7, all the other apps worked, even Drupal.
    Double-checked typing, cannot even run http://localhost/silverstripe/install.php...
    Was any testing done before this was put up to MS' site?????

    [Warning] mysql_connect() [function.mysql-connect]: Access denied for user 'silverstripeuser'@'localhost' (using password: YES)
    GET /silverstripe
    Line 35 in C:\inetpub\wwwroot\silverstripe\sapphire\core\model\MySQLDatabase.php

    Source
    26    /**
    27     * Connect to a MySQL database.
    28     * @param array $parameters An map of parameters, which should include:
    29     * - server: The server, eg, localhost
    30     * - username: The username to log on with
    31     * - password: The password to log on with
    32     * - database: The database to connect to
    33     */
    34    public function __construct($parameters) {
    35       $this->dbConn = mysql_connect($parameters['server'], $parameters['username'], $parameters['password']);
    36       $this->active = mysql_select_db($parameters['database'], $this->dbConn);
    37       $this->database = $parameters['database'];
    38       if(!$this->dbConn) {
    39          $this->databaseError("Couldn't connect to MySQL database");
    40       }
    41
    Trace
    •mysql_connect(localhost,silverstripeuser,********)
    Line 35 of MySQLDatabase.php
    •MySQLDatabase->__construct(Array)
    Line 72 of DB.php
    •DB::connect(Array)
    Line 109 of main.php

  • tom12010
    Avatar
    Community Member
    2 Posts

    Re: Error: C:\inetpub\wwwroot\silverstripe\sapphire\core\model\MySQLDatabase.php: Link to this post

    FIXED!!

    Downloaded mySQL Administrator, gave this database user ALL privileges, set up a connection, started again with http://localhost/silverstripe, then it came up.

    Pretty dumb of the WebPI installer not to set up table privileges etc. -- it was equally stupid with Drupal on some things, if that makes y'all feel any better...

  • Oyadioo
    Avatar
    Community Member
    1 Post

    Re: Error: C:\inetpub\wwwroot\silverstripe\sapphire\core\model\MySQLDatabase.php: Link to this post

    I have this same problem...

    Everything seems to be right.....it works fine on my local machine and my db user is root...

    When i upload and check this online,i get error Line 57 in E:\HostingSpaces\coreglob\core-globalservices.com.ng\wwwroot\testsite

    \sapphire\core\model\MySQLDatabase.php.

    When i try to connect to phpmyadmin using same username and password used in my connection string,i can connect.

    What could the problem be????is it that i do not have any privilege attached to my user????

    Please see error below.

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------

    [Warning] mysql_connect(): Access denied for user 'ennovate'@'XpertProWeb' (using password: YES)
    GET /testsite/

    Line 57 in E:\HostingSpaces\coreglob\core-globalservices.com.ng\wwwroot\testsite\sapphire\core\model\MySQLDatabase.php
    Source

    48     * Connect to a MySQL database.
    49     * @param array $parameters An map of parameters, which should include:
    50     * - server: The server, eg, localhost
    51     * - username: The username to log on with
    52     * - password: The password to log on with
    53     * - database: The database to connect to
    54     * - timezone: (optional) The timezone offset. For example: +12:00, "Pacific/Auckland", or "SYSTEM"
    55     */
    56    public function __construct($parameters) {
    57       $this->dbConn = mysql_connect($parameters['server'], $parameters['username'], $parameters['password'], true);
    58
    59       if(self::$connection_charset) {
    60          $this->query("SET CHARACTER SET '" . self::$connection_charset . "'");
    61          $this->query("SET NAMES '" . self::$connection_charset . "'");
    62       }
    63

    Trace

    mysql_connect(<filtered>,<filtered>,<filtered>,<filtered>)
    Line 57 of MySQLDatabase.php
    MySQLDatabase->__construct(Array)
    Line 97 of DB.php
    DB::connect(<filtered>)
    Line 121 of main.php
    require_once(E:\HostingSpaces\coreglob\core-globalservices.com.ng\wwwroot\testsite\sapphire\main.php)
    Line 63 of index.php

    3122 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.