The blog database is designed to support any number of websites all sharing the same database. This makes it easier to set up and define your websites since you only need to perform this step once, for your first website that requires a database blog. Subsequent websites can use this same database.
If you wish, you can define a separate database for for use in your sandbox environment or your sandbox can point to your production database if you wish. If you have installed GenHelm on a development machine, for example running under Windows, you could also define a separate blog database for this environment.
The database is named gh_blog. This database is created empty (with no records) and records are added using pages of your website. The SQL required to load the empty tables is stored in the following location:
This SQL needs to be executed from your database command line or using an SQL admin application such as MySQL Workbench. Other databases such as Maria DB, PostgreSQL and other databases offering compatibility with MySQL should also work.
If you are creating this as a MySQL database under cPanel you will need to create the database first within cPanel as shown here:
Next you link a user to the gh_blog database. If you wish you can define a new user for use with gh_blog or you can link an existing user. This user does not require a great deal of privileges, however they will need to be able to select, insert, update and delete table rows. Note that a "user" in this context does not usually correspond to an actual person. This is to say that you only need to define one database user irrespective of how many bloggers will be defining new blogs.
If you created the empty database using this method it will be necessary to modify the supplied SQL before you execute it. Edit the SQL using any editor and remove the following statements and then save the updated SQL:
CREATE DATABASE `gh_blog`;
Be sure to select the gh_blog database on the left panel before you attempt to import it. Now you can create the tables in the database by importing the SQL into phpMyAdmin as shown:
Notice that the Enable foreign key checks option is not checked. Checking this option may result in the MySQL Error Code 1215: “Cannot add foreign key constraint” so leave this unchecked to avoid this.
After selecting the script file and unchecking the foreign key check option press the Go button.
If the script runs successfully you should see a series of messages like the ones shown here.
Now that the database is loaded you will need to create a db_config and schema definition in GenHelm. Normally these definitions will be defined within system so that they can be used by any website.
To create the db_config definition enter the command e db_config after logging on to system. Fill in the information shown below and connect the user that was given access to the gh_blog database by entering the correct user id and password. Also enter the correct database name and select the environments that are allowed to point to this database. In our example, we are configuring a database for use in the sandbox.
If you created your database in the sandbox, you will want to repeat these steps to create the database in the live environment. As mentioned, there is no need for a separate sandbox blog database but you might want to set one up to help test your sites before they go live. Alternatively, you can just point to your production database from your sandbox.
The next step is to use the schema model to define the blog database. Here we are creating a schema called gh_blog. Although the name that you give to your physical database can be whatever you want, this schema definition must be named gh_blog. Otherwise the pages that read and maintain your blog won't be able to find it.
If you are creating this schema within system, there should already be a skeleton definition which you can modify by using the command edit gh_blog. If you are not creating this within system, use the command edit schema to start a new schema definition.
This definition determines which database will be used in each environment. If you want the sandbox to point to the live database, both of these settings would reference the same db_config definition.
Next, make sure that your database server is running. You are now ready to perform blog maintenance. Use your browser's back button to return to the help related to blog maintenance.