Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>During the initial startup and working with Yii, the first problem that I faced was connecting to the database. </p> <p>I was getting a really weird error and I was not able to connect to my DB on my Mac OSX Mountain Lion on my XAMPP stack. After countless searches, I finally figured out a method that worked. This is the only way I am able to connect to my DB for Yii.</p> <ol> <li><p>First check if you can connect to the database normally using the default configuration by uncommenting the 'db' configuration in the main.php file. Example : </p> <pre><code>'db'=&gt;array( 'connectionString' =&gt; 'mysql:host=localhost;dbname=ascodcurro_com', 'emulatePrepare' =&gt; true, 'username' =&gt; 'username', 'password' =&gt; 'pass', 'charset' =&gt; 'utf8', 'tablePrefix'=&gt;'', 'enableProfiling'=&gt;true, 'enableParamLogging'=&gt;true, ), </code></pre></li> </ol> <p>However, if you are still not able to connect to the database even after this, as I wasn't able to connect to mine, try taking this approach : Make a new php file and type :</p> <pre><code>&lt;?php phpinfo() ?&gt; </code></pre> <p>check that page out, find out where '<em>mysql</em>' is located and find out the '<strong>MYSQL_SOCKET</strong>' in it and note the location.</p> <p>After noting the location down, try this as your 'db' connection string(for example, for me the location is "<em>/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock</em>") :</p> <pre><code> 'connectionString' =&gt; 'mysql:unix_socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock;dbname=practice', </code></pre> <p>And the rest as the basic parameters that you use. And then try connecting again. </p> <p>Hopefully, that should connect you to your DB.</p> <p>Regards,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload