My blog software is WordPress which is using a MySQL database. My task is to document the database design. Let us see how I accomplish this goal.
My first step is to back up the database because I need a local copy to work with. I log into phpMyAdmin 2.5.0 and export the database as a SQL text file. There is no need to describe this step because it is well documented on the Internet. This gives me a phpMyAdmin MySQL-Dump file which reveals the database design but not in a format I find very readable.
Next I want to import the database backup into my local MySQL Database Server. First I need to create the database “wordpress”, then I use the MySQL Administrator’s Restore option to restore the database using the SQL file, making sure the target schema is my new database and the checkbox “Create database(s) if they don’t exist” is checked.
Then I download and install the ODBC driver for MySQL. You can get it here: http://dev.mysql.com/downloads/connector/odbc/3.51.html I want to create a SQL Server database version of the WordPress MySQL database so I create a new SQL Server database and start the DTS Import / Export Wizard.
Because I installed the ODBC driver for MySQL I now find a new option in the data source drop down list:
When I select that option I discover that I need to create a Data Source Name for the MySQL database I want to import:
I click the Test button and find I can connect to the database:
When I attempt to import all the tables, I get 11 tables copied but 2 show errors:
There was an error importing the wp_links table Error at Destination for Row number 1. Errors encountered so far in this task: 1. Insert error, column 11 (‘link_updated’, DBTYPE_DBTIMESTAMP), status 10: Integrity violation; attempt to insert NULL data or data which violates constraints. Unspecified error
And an error importing the wp_users table Error at Destination for Row number 1. Errors encountered so far in this task: 1. Insert error, column 13 (‘dateYMDhour’, DBTYPE_DBTIMESTAMP), status 10: Integrity violation; attempt to insert NULL data or data which violates constraints. Unspecified error
To solve these errors I just edit the SQL Server database design for these tables and allow these fields to accept NULL values:
Then I attempt to import just these two tables again and this time it works:
Since that went pretty well I attempt the same thing with Microsoft Access. I try to import the MySQL database using ODBC Databases as the file type and select my data source name which already exists now. Unfortunately Microsoft Office Access has a problem and needs to close:
Since that does not work I just export my SQL Server database to my Access database which succeeds with no errors:
Now that I have all my tables and data in Access I can document the database design using its documentation wizard. Select Tools from the menu and then select Analyze and then Documenter. Click the Select All button and then the OK button.
Now I can export the table design reports as web pages so you can view them online. Select File from the menu and then Export. Select HTML as the “save as type”. The table design reports will be exported as web pages complete with navigation links. You can view the talbe design of the MySQL database used by the WordPress blog here:
http://www.williamsportwebdeveloper.com/design/wordpress_db.html