<p>Check to make sure you have a <code>db.php</code> file here:</p>

<pre><code>craft/app/etc/config/defaults/db.php
</code></pre>

<p>If not, <a href="https://craftcms.com/support/download-previous-versions" rel="nofollow noreferrer">download a fresh copy of the version of Craft you're using</a> and replace your <code>craft/app</code> folder with the one you just downloaded.</p>

<p>This file was missing in my Git repository because the <code>.gitignore</code> file was set to ignore all <code>db.php</code> files on the site, not just the one they wanted to ignore in the <code>craft/config</code> folder.</p>

<p>If that's the case, make sure your .gitignore file uses a line like this:</p>

<pre><code>craft/config/db.php
</code></pre>

<p>Instead of just this:</p>

<pre><code>db.php
</code></pre>

CC BY-SA 3.0
2016-11-17T10:34:29.730Z
2016-11-17T10:34:29.730Z
Alex Roper
<p>We have 2 computers with a new Craft Pro trial installation. The files are exactly the same on both computers. We both use the same DB with the same <code>db.php</code> config settings.  We can both see the site and login to the <code>/admin</code> section.</p>

<p>The only issue is that on 1 computer I can not create a Matrix field or install a plugin. Then I get the error:</p>

<pre><code>CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE=' at line 8
</code></pre>

<p>The other computer has no problem creating a Matrix field or installing a plugin. Any suggestions? Thanks!</p>

CC BY-SA 3.0
2016-03-16T19:50:32.040Z
Are the installs on two separate servers or are they on the same box? What version of MariaDB? Can you share the whole SQL statement that's trying to execute?
Brad Bell
CC BY-SA 3.0
2016-03-17T08:22:25.637Z
Installations are on 2 different laptops, each have their own local environment. MariaDB Server version: 10.1.10
Rbijker.com
CC BY-SA 3.0
2016-03-17T08:32:29.700Z
The specs of the one with the issue: Apache/2.4.16 (Unix) PHP/5.6.17 - MariaDB Server version: 10.1.10.
On this link you will find the full debug output: http://pastebin.com/rFRRHvGU
Rbijker.com
CC BY-SA 3.0
2016-03-17T08:40:47.137Z
Actually, the DB is on a separate server that both laptops connect to. MySQL version: 5.6.26. But when I move the DB to my local MariaDB and connect to it I still have the same issue.
Rbijker.com
CC BY-SA 3.0
2016-03-17T09:13:44.543Z
We made a var_dump the method $this->setText($this->getConnection()->getSchema()->createTable($table, $columns, $options)); in file craft/app/framework/db/CDbCommand.php. On the computer with the issue we see CHARSET= COLLATE=. On the other computer we see: CHARSET=utf8 COLLATE=utf8_unicode_ci . see full var_dump here: http://pastebin.com/qYk0Lu7i
Rbijker.com
CC BY-SA 3.0
2016-03-17T10:13:30.403Z
I just installed fresh copy of Craft on the laptop and in this fresh installation there is no issue with creating a Matrix field or installing a plugin. The CHARSET=utf8 and COLLATE=utf8_unicode_ci. So I really wonder why this issue occurs in the craft project that I pulled from the repository and not in a fresh installed one.
Rbijker.com
CC BY-SA 3.0
2016-03-17T21:39:11.440Z
Are you setting these to empty strings in your `craft/config/db.php` file maybe? https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/db.php#L43-L51
Brad Bell
<database><craft-pro><mysql><setup>
Error when creating a Matrix or installing a Plugin
# Error when creating a Matrix or installing a Plugin

(Asked by: username_0 on 2016-03-16)

We have 2 computers with a new Craft Pro trial installation. The files are exactly the same on both computers. We both use the same DB with the same db.php config settings.  We can both see the site and login to the /admin section.
The only issue is that on 1 computer I can not create a Matrix field or install a plugin. Then I get the error:
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE=' at line 8

The other computer has no problem creating a Matrix field or installing a plugin. Any suggestions? Thanks!

**Tags:** database, craft-pro, mysql, setup
> **Comments:**
> **username_1**: Are the installs on two separate servers or are they on the same box? What version of MariaDB? Can you share the whole SQL statement that's trying to execute?  
> **username_0**: Installations are on 2 different laptops, each have their own local environment. MariaDB Server version: 10.1.10  
> **username_0**: The specs of the one with the issue: Apache/2.4.16 (Unix) PHP/5.6.17 - MariaDB Server version: 10.1.10. On this link you will find the full debug output: http://pastebin.com/rFRRHvGU  
> **username_0**: Actually, the DB is on a separate server that both laptops connect to. MySQL version: 5.6.26. But when I move the DB to my local MariaDB and connect to it I still have the same issue.  
> **username_0**: We made a var_dump the method $this->setText($this->getConnection()->getSchema()->createTable($table, $columns, $options)); in file craft/app/framework/db/CDbCommand.php. On the computer with the issue we see CHARSET= COLLATE=. On the other computer we see: CHARSET=utf8 COLLATE=utf8_unicode_ci . see full var_dump here: http://pastebin.com/qYk0Lu7i  
> **username_0**: I just installed fresh copy of Craft on the laptop and in this fresh installation there is no issue with creating a Matrix field or installing a plugin. The CHARSET=utf8 and COLLATE=utf8_unicode_ci. So I really wonder why this issue occurs in the craft project that I pulled from the repository and not in a fresh installed one.  
> **username_1**: Are you setting these to empty strings in your `craft/config/db.php` file maybe? https://github.com/pixelandtonic/Craft-Release/blob/master/app/etc/config/defaults/db.php#L43-L51  

---

## 1 answers

### Answer by username_2 on 2016-11-17. Score: 1

Check to make sure you have a db.php file here:
craft/app/etc/config/defaults/db.php

If not, download a fresh copy of the version of Craft you're using and replace your craft/app folder with the one you just downloaded.
This file was missing in my Git repository because the .gitignore file was set to ignore all db.php files on the site, not just the one they wanted to ignore in the craft/config folder.
If that's the case, make sure your .gitignore file uses a line like this:
craft/config/db.php

Instead of just this:
db.php


---

