Orchard and MySQL

Orchard and MySQL

In Orchard 1.6, Orchard Websites can use MySQL as a database along with SQL Server, SQL Express, and SQL Server Compact (Sql CE). Orchard CMS Developers can easily find affordable web hosting that comes with MySQL, making Orchard a very attractive option to small businesses and developers more familiar with MySQL than SQL Server. As you will see in this Orchard Tutorial, using Orchard and MySQL is just as easy as using SQL Server.

Orchard CMS and MySQL

Orchard 1.6 is the version that supports MySQL. If you remember, Orchard 1.6 will be the version of Orchard CMS with ASP.NET MVC 4, Web API, and NHibernate 3 as well as other enhancements like MySQL support. When you run Orchard 1.6 for the first time you come to the usual setup screen requesting your Orchard Website Name, Site Owner Username, Password, the type of database you will be using, and the Orchard Recipe.

Notice that in Orchard 1.6 the database section has been enhanced to include MySQL as an option. Here you can choose "Use an existing MySql database" and then enter the "Connection string" for MySQL as well as optionally a "Database Table Prefix." The Database Table Prefix is completely optional and useful if you want to configure multiple Orchard Websites to use a single MySQL database, but separate tables.

Orchard CMS and MySQL Database

As you can see, choosing MySQL as a database for Orchard is as simple as choosing SQL Server or SQL Server Express.

MySQL Workbench and Orchard CMS Tables

Once you have installed Orchard CMS to use MySQL, fire up MySQL Workbench to view the Orchard Tables in your database. I went ahead and prefixed my database tables with "one" so I can re-use this MySQL Database with multiple instances of Orchard. Notice how each Orchard Table is prefixed as "one_" and then the name of the table.

Orchard CMS Database Tables in MySQL Workbench

If you want to use the same MySQL Database for all your Orchard instances, just use the same connection string during setup, but vary the database table prefix for each instance.

Orchard and MySQL Performance

I haven't run any tests, but theoretically you will see an improvement in performance using MySQL in comparison to SQL Server Compact, which is what I often use for small websites. Of course, if you are using the Cache Module in Orchard, the cache module could make up for any performance differences as it alleviates a lot of pressure on the database. Still, caching aside, if you are running a small website and deciding between MySQL and SQL Server Compact, I expect you to get better performance from MySQL. And, like I mentioned before, most affordable host providers do provide MySQL as part of their base package, allowing you to get that additional performance at usually no extra cost.

Conclusion

I am really excited about MySQL as a database option for Orchard CMS. First, I love providing the option for my clients. Second, there are a lot of Wordpress Developers with more experience with MySQL as opposed to SQL Server that I hope will look more into Orchard CMS as an option for their clients.

If you are looking to hire an Orchard web developer, contact me.