Upgrading MovableType Database
In a related story, you have read that I changed our web server from Windows to Linux. This caused me to lose the MovableType templates I had been using and so I created new ones (using the StyleCatcher plugin) - you probably have noticed the shocking purple color. Well, I thought that StyleCatcher was so interesting that I started exploring other plugins to replace hardwired functions in my old blog. I quickly found MT Blogroll for keeping a list of blog links.
I began the installation of the MT Blogroll plugin and quickly ran into problems - when I tried to use the plugin, I would get the message: "Before you can begin using the plugin, we need to complete your installation by initializing your database." I would click Finish Install, only to be told: "Your database is already current." Found the answer here (http://forums.movalog.com/viewtopic.php?pid=1124#p1124) which clearly stated that if you were using the Berkeley DB (standard with MovableType) the MT Blogroll plugin would not work.
At this point, a wise person would have added two lines of html to the Main Index template and hardwired the two blog links I wanted to display. But I was not wise. I thought, hmmmmm, how bad could it be to upgrade from Berkeley DB to mySQL? After all, I already had mySQL installed and I am comfortable with databases.
I started here an excellent tutorial dedicated to this topic that gave me the confidence to move forward. Since I had mySQL installed, I was able to jump to Step 3, installing the extensions to Perl to talk to mySQL. Here I hit my first problem - CPAN could not install the DBI or DBD::mysql modules. Not much of an error message, just that the build was "NOT OK". Undaunted, I thought I would try to do the make by hand, and went to the directory //root/.cpan/build/
I now continue on on the tutorial - creating the database, establishing an owner, granting privileges. I learn that in mysql there is a space between the -username flag and the username, but no space between the -password flag and the password. Strange, but true. I edit the mt-config.cgi to enable the mysql drivers and disable Berkeley DB and am up to step #6 - running the mt-db2sql.cgi script. I get the error: "No ObjectDriver defined at /srv/www/cgi-bin/mt/lib/MT/Object.pm line 144" and find that there are references to this on the web, but before checking into that, I review my mt-config.cgi and realize that I can't disable the Berkeley DB just yet. So, I reenable Berkeley DB (so that I have both enabled) and re-run mt-db2sql.cgi script - and it works!
My next step is to try and finish the installation of the MT Blogroll plugin. But not so fast. As soon as I start working with my blog in MT, I find that I have to login after I click anything. This is driving me crazy. At least one login page per click. I find the solution here (http://www.sixapart.com/movabletype/forums/index.php?showtopic=56070) which indicates that there is a bug in mt-db2sql.cgi - two tables do not get created in the mysql database. The create table code is provided. I found that I had to remove the strange quotes and change:
`session_id` varchar(80) NOT NULL default , TO
`session_id` varchar(80) NOT NULL,
But after I did that, the login problem was solved!
Along the way, I learned that to copy text into a shell/window on linux, just click the middle mouse button (or scroll button, or left and right buttons together) - that was a big win :).
Now, I try to complete the installation of the MT Blogroll plug-in and it works! Now I can configure the MT Blogroll plugin and that goes smoothly, until I get to the issue of showing the last updated time of the blogs. I see posts on the web indicating this has never worked, but I find a valuable reference (http://www.movalog.com/plugins/wiki/MtBlogroll/UpdateLinks). I had already obtained my Technorati API key, but the essential information this posting contained was that you needed to run ./plugins/Blogroll/update-links.cgi. I try to run that and get the error message "Got an error: Can't locate XML/Simple.pm". Figured out that I needed to go into CPAN and install XML::Simple. But of course CPAN fails at the build step. But I can use the same building by hand trick mentioned above and then when I go into CPAN and try to install XML::Simple again, I get the gratifying message: XML::Simple is up to date.
I do the usual blog rebuilding and I have a list of blogs and if you mouseover them, you can see when they were last updated. Note: to keep this current, I followed the instructions to add this script to my crontab file.
Comments
Well, this posting came in handy for me as the problem recurred. I checked to see if the cookie was being created (it was) and that it looked correct (it was). So then I went to look at the mt_session table. When I selected my blog database with "use xyz;", I got the message that the mt_session table had no fields - it had become corrupted and the login problem had returned. I dropped the table, recreated it and all is well!
Posted by: Richard Berger | February 16, 2006 08:56 AM