使用MySQL作为BlogEngine.NET 的数据库引擎
2010-11-05 12:51 jinze 阅读(770) 评论(0) 编辑 收藏 举报什么是BlogEngine.NET
BlogEngine是一个基于ASP.NET 的开源博客引擎,您可以在BlogEngien.NET项目主页或者codeplex上下载到该项目的所有源代码,非常强大,支持的数据库包括Microsoft SQL Server, MySQL, VistaDB,当然,也可以不使用有数据库,而使用XML作为数据存储引擎,但是这种方法 并不推荐,因为你可能牵扯到文件读写权限的问题,也就是说,如果使用的第三方提供的虚拟主机服务,而你又没有虚拟主机上 相应目录的读写权限,那么你很有可能会在操作的时候出现各种各样的问题,所有,推荐使用数据库,另外,BlogEngien.NET 的官方版本会出现中文乱码问题,解决这个问题您可以把相应的字符编码类进行修改就可以了,也就是说把
修改为:
不用担心,不会出现任何问题。
如果使用数据库的话,该使用什么数据库呢?对于个人博客引擎来说,免费且开源的MySQL已经足以我们的需要了,当然,如果你的博客每天有上千万次的访问量话,不在此列,下面,让我们来看看该如何使用MySQL做BlogEngine.NET的数据库引擎。
使用MySQL做BlogEngine.NET 的数据库引擎
为了可以和MySQL共事,您首先需要下载MySQl在ASP.NET 上的驱动文件,使MySQL可以在ASP .NET 上使用,首先需要下载的是 MySQL .NET Connector 6.2.2 ,可以在官方下载到,也可以直接在这里下载到它的 6.2.2 版本 系统默认的版本是6.2.2 当然,如果存在新版本的话,您也可以直接在web.config 里修改。
将 MySQL .NET Connector 安装完成之后,拷贝安装目录下的MySQL.Data.DLL 到Bin目录,我们的博客引擎接下来就可以使用我们的数据库引擎了,当然,前提是您已经有一个可用的MySQL数据库了,MySQL的安装非常简单,您可以在www.mysql.com 上免费下载到最新的版本,也支持您的Windows7。接下来,我们需要在我们的MySQL中建立BlogEngien.NET 需要的数据库和表。
建立BlogEngien.NET 需要的数据库和表
首先,打开MYSQL的命令界面(任何可以执行MySQl命令的界面),执行以下命令
建立数据库:
建立相应的表:
`CategoryID` varchar(36) NOT NULL DEFAULT '',
`CategoryName` varchar(50) DEFAULT NULL,
`Description` varchar(200) DEFAULT NULL,
`ParentID` varchar(36) DEFAULT NULL,
PRIMARY KEY (`CategoryID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_DataStoreSettings` (
`ExtensionType` varchar(50) NOT NULL,
`ExtensionId` varchar(100) NOT NULL,
`Settings` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_Pages` (
`PageID` varchar(36) NOT NULL DEFAULT '',
`Title` varchar(255) NOT NULL DEFAULT '',
`Description` text,
`PageContent` longtext,
`Keywords` text,
`DateCreated` datetime DEFAULT NULL,
`DateModified` datetime DEFAULT NULL,
`IsPublished` tinyint(1) DEFAULT NULL,
`IsFrontPage` tinyint(1) DEFAULT NULL,
`Parent` varchar(64) DEFAULT NULL,
`ShowInList` tinyint(1) DEFAULT NULL,
`Slug` varchar(255) DEFAULT NULL,
PRIMARY KEY (`PageID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_PingService` (
`PingServiceID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`Link` varchar(255) DEFAULT NULL,
PRIMARY KEY (`PingServiceID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_Posts` (
`PostID` varchar(36) NOT NULL DEFAULT '',
`Title` varchar(255) NOT NULL DEFAULT '',
`Description` text NOT NULL,
`PostContent` longtext NOT NULL,
`DateCreated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`DateModified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Author` varchar(50) NOT NULL DEFAULT '',
`IsPublished` tinyint(1) NOT NULL DEFAULT '0',
`IsCommentEnabled` tinyint(1) NOT NULL DEFAULT '0',
`Raters` int(10) UNSIGNED NOT NULL DEFAULT '0',
`Rating` float NOT NULL DEFAULT '0',
`Slug` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`PostID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_Profiles` (
`ProfileID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`UserName` varchar(100) NOT NULL,
`SettingName` varchar(200) NOT NULL,
`SettingValue` text NOT NULL,
PRIMARY KEY (`ProfileID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_Roles` (
`RoleID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`Role` varchar(100) NOT NULL,
PRIMARY KEY (`RoleID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
CREATE TABLE `be_Settings` (
`SettingName` varchar(50) NOT NULL,
`SettingValue` text,
PRIMARY KEY (`SettingName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_StopWords` (
`StopWord` varchar(50) NOT NULL,
PRIMARY KEY (`StopWord`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_Users` (
`UserID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`UserName` varchar(100) DEFAULT NULL,
`Password` varchar(255) DEFAULT NULL,
`LastLoginTime` datetime DEFAULT '0000-00-00 00:00:00',
`EmailAddress` varchar(100) DEFAULT NULL,
PRIMARY KEY (`UserID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
CREATE TABLE `be_UserRoles` (
`UserRoleID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`UserID` int(10) UNSIGNED NOT NULL DEFAULT '0',
`RoleID` int(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`UserRoleID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
CREATE TABLE `be_PostCategory` (
`PostCategoryID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`PostID` varchar(36) NOT NULL DEFAULT '',
`CategoryID` varchar(36) NOT NULL DEFAULT '',
PRIMARY KEY (`PostCategoryID`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
CREATE TABLE `be_PostComment` (
`PostCommentID` varchar(36) NOT NULL DEFAULT '',
`PostID` varchar(36) NOT NULL DEFAULT '',
`ParentCommentID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`CommentDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Author` varchar(255) NOT NULL DEFAULT '',
`Email` varchar(255) NOT NULL DEFAULT '',
`Website` varchar(255) NOT NULL DEFAULT '',
`Comment` text NOT NULL,
`Country` varchar(255) NOT NULL DEFAULT '',
`Ip` varchar(50) NOT NULL DEFAULT '',
`IsApproved` tinyint(1) NOT NULL DEFAULT '0',
`ModeratedBy` varchar(100) DEFAULT NULL,
`Avatar` varchar(255) DEFAULT NULL,
PRIMARY KEY (`PostCommentID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_PostNotify` (
`PostNotifyID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`PostID` varchar(36) NOT NULL DEFAULT '',
`NotifyAddress` varchar(255) DEFAULT NULL,
PRIMARY KEY (`PostNotifyID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `be_PostTag` (
`PostTagID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`PostID` varchar(36) NOT NULL DEFAULT '',
`Tag` varchar(50) DEFAULT NULL,
PRIMARY KEY (`PostTagID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `be_BlogRollItems` (
`BlogRollID` varchar(36) NOT NULL,
`Title` varchar(255) NOT NULL,
`Description` longtext DEFAULT NULL,
`BlogUrl` varchar(255) NOT NULL,
`FeedUrl` varchar(255) DEFAULT NULL,
`Xfn` varchar(255) DEFAULT NULL,
`SortIndex` int(10) NOT NULL,
PRIMARY KEY (`BlogRollID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `be_Referrers` (
`ReferrerId` varchar(36) NOT NULL,
`ReferralDay` datetime NOT NULL,
`ReferrerUrl` varchar(255) NOT NULL,
`ReferralCount` int(10) NOT NULL,
`Url` varchar(255) DEFAULT NULL,
`IsSpam` tinyint(1) NULL,
PRIMARY KEY (`ReferrerId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*** Load initial Data ***/
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('administratorrole', 'Administrators');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('alternatefeedurl', '');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('authorname', 'My name');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('avatar', 'combine');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('blogrollmaxlength', '23');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('blogrollupdateminutes', '60');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('blogrollvisibleposts', '3');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('contactformmessage', '<p>I will answer the mail as soon as I can.</p>');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('contactthankmessage', '<h1>Thank you</h1><p>The message was sent.</p>');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('culture', 'Auto');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('dayscommentsareenabled', '0');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('description', 'Short description of the blog');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('displaycommentsonrecentposts', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('displayratingsonrecentposts', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('email', 'user@example.com');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('emailsubjectprefix', 'Weblog');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablecommentsearch', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablecommentsmoderation', 'False');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablecontactattachments', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablecountryincomments', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablehttpcompression', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enableopensearch', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablepingbackreceive', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablepingbacksend', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablerating', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablereferrertracking', 'False');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablerelatedposts', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enablessl', 'False');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enabletrackbackreceive', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('enabletrackbacksend', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('endorsement', 'http://www.dotnetblogengine.net/syndication.axd');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('fileextension', '.aspx');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('geocodinglatitude', '0');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('geocodinglongitude', '0');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('handlewwwsubdomain', '');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('iscocommentenabled', 'False');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('iscommentsenabled', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('language', 'en-GB');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('mobiletheme', 'Mobile');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('name', 'Name of the blog');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('numberofrecentcomments', '10');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('numberofrecentposts', '10');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('postsperfeed', '10');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('postsperpage', '10');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('removewhitespaceinstylesheets', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('searchbuttontext', 'Search');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('searchcommentlabeltext', 'Include comments in search');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('searchdefaulttext', 'Enter search term');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('sendmailoncomment', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('showdescriptioninpostlist', 'False');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('showlivepreview', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('showpostnavigation', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('smtppassword', 'password');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('smtpserver', 'mail.example.dk');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('smtpserverport', '25');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('smtpusername', 'user@example.com');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('storagelocation', '~/App_Data/');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('syndicationformat', 'Rss');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('theme', 'Standard');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('timestamppostlinks', 'True');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('timezone', '-5');
INSERT INTO be_Settings (SettingName, SettingValue) VALUES ('trackingscript', '');
INSERT INTO be_PingService (Link) VALUES ('http://rpc.technorati.com/rpc/ping');
INSERT INTO be_PingService (Link) VALUES ('http://rpc.pingomatic.com/rpc2');
INSERT INTO be_PingService (Link) VALUES ('http://ping.feedburner.com');
INSERT INTO be_PingService (Link) VALUES ('http://www.bloglines.com/ping');
INSERT INTO be_PingService (Link) VALUES ('http://services.newsgator.com/ngws/xmlrpcping.aspx');
INSERT INTO be_PingService (Link) VALUES ('http://api.my.yahoo.com/rpc2 ');
INSERT INTO be_PingService (Link) VALUES ('http://blogsearch.google.com/ping/RPC2');
INSERT INTO be_PingService (Link) VALUES ('http://rpc.pingthesemanticweb.com/');
INSERT INTO be_StopWords (StopWord) VALUES ('a');
INSERT INTO be_StopWords (StopWord) VALUES ('about');
INSERT INTO be_StopWords (StopWord) VALUES ('actually');
INSERT INTO be_StopWords (StopWord) VALUES ('add');
INSERT INTO be_StopWords (StopWord) VALUES ('after');
INSERT INTO be_StopWords (StopWord) VALUES ('all');
INSERT INTO be_StopWords (StopWord) VALUES ('almost');
INSERT INTO be_StopWords (StopWord) VALUES ('along');
INSERT INTO be_StopWords (StopWord) VALUES ('also');
INSERT INTO be_StopWords (StopWord) VALUES ('an');
INSERT INTO be_StopWords (StopWord) VALUES ('and');
INSERT INTO be_StopWords (StopWord) VALUES ('any');
INSERT INTO be_StopWords (StopWord) VALUES ('are');
INSERT INTO be_StopWords (StopWord) VALUES ('as');
INSERT INTO be_StopWords (StopWord) VALUES ('at');
INSERT INTO be_StopWords (StopWord) VALUES ('be');
INSERT INTO be_StopWords (StopWord) VALUES ('both');
INSERT INTO be_StopWords (StopWord) VALUES ('but');
INSERT INTO be_StopWords (StopWord) VALUES ('by');
INSERT INTO be_StopWords (StopWord) VALUES ('can');
INSERT INTO be_StopWords (StopWord) VALUES ('cannot');
INSERT INTO be_StopWords (StopWord) VALUES ('com');
INSERT INTO be_StopWords (StopWord) VALUES ('could');
INSERT INTO be_StopWords (StopWord) VALUES ('de');
INSERT INTO be_StopWords (StopWord) VALUES ('do');
INSERT INTO be_StopWords (StopWord) VALUES ('down');
INSERT INTO be_StopWords (StopWord) VALUES ('each');
INSERT INTO be_StopWords (StopWord) VALUES ('either');
INSERT INTO be_StopWords (StopWord) VALUES ('en');
INSERT INTO be_StopWords (StopWord) VALUES ('for');
INSERT INTO be_StopWords (StopWord) VALUES ('from');
INSERT INTO be_StopWords (StopWord) VALUES ('good');
INSERT INTO be_StopWords (StopWord) VALUES ('has');
INSERT INTO be_StopWords (StopWord) VALUES ('have');
INSERT INTO be_StopWords (StopWord) VALUES ('he');
INSERT INTO be_StopWords (StopWord) VALUES ('her');
INSERT INTO be_StopWords (StopWord) VALUES ('here');
INSERT INTO be_StopWords (StopWord) VALUES ('hers');
INSERT INTO be_StopWords (StopWord) VALUES ('his');
INSERT INTO be_StopWords (StopWord) VALUES ('how');
INSERT INTO be_StopWords (StopWord) VALUES ('i');
INSERT INTO be_StopWords (StopWord) VALUES ('if');
INSERT INTO be_StopWords (StopWord) VALUES ('in');
INSERT INTO be_StopWords (StopWord) VALUES ('into');
INSERT INTO be_StopWords (StopWord) VALUES ('is');
INSERT INTO be_StopWords (StopWord) VALUES ('it');
INSERT INTO be_StopWords (StopWord) VALUES ('its');
INSERT INTO be_StopWords (StopWord) VALUES ('just');
INSERT INTO be_StopWords (StopWord) VALUES ('la');
INSERT INTO be_StopWords (StopWord) VALUES ('like');
INSERT INTO be_StopWords (StopWord) VALUES ('long');
INSERT INTO be_StopWords (StopWord) VALUES ('make');
INSERT INTO be_StopWords (StopWord) VALUES ('me');
INSERT INTO be_StopWords (StopWord) VALUES ('more');
INSERT INTO be_StopWords (StopWord) VALUES ('much');
INSERT INTO be_StopWords (StopWord) VALUES ('my');
INSERT INTO be_StopWords (StopWord) VALUES ('need');
INSERT INTO be_StopWords (StopWord) VALUES ('new');
INSERT INTO be_StopWords (StopWord) VALUES ('now');
INSERT INTO be_StopWords (StopWord) VALUES ('of');
INSERT INTO be_StopWords (StopWord) VALUES ('off');
INSERT INTO be_StopWords (StopWord) VALUES ('on');
INSERT INTO be_StopWords (StopWord) VALUES ('once');
INSERT INTO be_StopWords (StopWord) VALUES ('one');
INSERT INTO be_StopWords (StopWord) VALUES ('ones');
INSERT INTO be_StopWords (StopWord) VALUES ('only');
INSERT INTO be_StopWords (StopWord) VALUES ('or');
INSERT INTO be_StopWords (StopWord) VALUES ('our');
INSERT INTO be_StopWords (StopWord) VALUES ('out');
INSERT INTO be_StopWords (StopWord) VALUES ('over');
INSERT INTO be_StopWords (StopWord) VALUES ('own');
INSERT INTO be_StopWords (StopWord) VALUES ('really');
INSERT INTO be_StopWords (StopWord) VALUES ('right');
INSERT INTO be_StopWords (StopWord) VALUES ('same');
INSERT INTO be_StopWords (StopWord) VALUES ('see');
INSERT INTO be_StopWords (StopWord) VALUES ('she');
INSERT INTO be_StopWords (StopWord) VALUES ('so');
INSERT INTO be_StopWords (StopWord) VALUES ('some');
INSERT INTO be_StopWords (StopWord) VALUES ('such');
INSERT INTO be_StopWords (StopWord) VALUES ('take');
INSERT INTO be_StopWords (StopWord) VALUES ('takes');
INSERT INTO be_StopWords (StopWord) VALUES ('that');
INSERT INTO be_StopWords (StopWord) VALUES ('the');
INSERT INTO be_StopWords (StopWord) VALUES ('their');
INSERT INTO be_StopWords (StopWord) VALUES ('these');
INSERT INTO be_StopWords (StopWord) VALUES ('thing');
INSERT INTO be_StopWords (StopWord) VALUES ('this');
INSERT INTO be_StopWords (StopWord) VALUES ('to');
INSERT INTO be_StopWords (StopWord) VALUES ('too');
INSERT INTO be_StopWords (StopWord) VALUES ('took');
INSERT INTO be_StopWords (StopWord) VALUES ('und');
INSERT INTO be_StopWords (StopWord) VALUES ('up');
INSERT INTO be_StopWords (StopWord) VALUES ('use');
INSERT INTO be_StopWords (StopWord) VALUES ('used');
INSERT INTO be_StopWords (StopWord) VALUES ('using');
INSERT INTO be_StopWords (StopWord) VALUES ('very');
INSERT INTO be_StopWords (StopWord) VALUES ('was');
INSERT INTO be_StopWords (StopWord) VALUES ('we');
INSERT INTO be_StopWords (StopWord) VALUES ('well');
INSERT INTO be_StopWords (StopWord) VALUES ('what');
INSERT INTO be_StopWords (StopWord) VALUES ('when');
INSERT INTO be_StopWords (StopWord) VALUES ('where');
INSERT INTO be_StopWords (StopWord) VALUES ('who');
INSERT INTO be_StopWords (StopWord) VALUES ('will');
INSERT INTO be_StopWords (StopWord) VALUES ('with');
INSERT INTO be_StopWords (StopWord) VALUES ('www');
INSERT INTO be_StopWords (StopWord) VALUES ('you');
INSERT INTO be_StopWords (StopWord) VALUES ('your');
INSERT INTO be_BlogRollItems ( BlogRollId, Title, Description, BlogUrl, FeedUrl, Xfn, SortIndex )
VALUES ( '25e4d8da-3278-4e58-b0bf-932496dabc96', 'Mads Kristensen', 'Full featured simplicity in ASP.NET and C#', 'http://www.madskristensen.dk/', 'http://feeds.feedburner.com/netslave', 'contact', 0 );
INSERT INTO be_BlogRollItems ( BlogRollId, Title, Description, BlogUrl, FeedUrl, Xfn, SortIndex )
VALUES ( 'ccc817ef-e760-482b-b82f-a6854663110f', 'Al Nyveldt', 'Adventures in Code and Other Stories', 'http://www.nyveldt.com/blog/', 'http://feeds.feedburner.com/razorant', 'contact', 1 );
INSERT INTO be_BlogRollItems ( BlogRollId, Title, Description, BlogUrl, FeedUrl, Xfn, SortIndex )
VALUES ( 'dcdaa78b-0b77-4691-99f0-1bb6418945a1', 'Ruslan Tur', '.NET and Open Source: better together', 'http://rtur.net/blog/', 'http://feeds.feedburner.com/rtur', 'contact', 2 );
INSERT INTO be_BlogRollItems ( BlogRollId, Title, Description, BlogUrl, FeedUrl, Xfn, SortIndex )
VALUES ( '8a846489-b69e-4fde-b2b2-53bc6104a6fa', 'John Dyer', 'Technology and web development in ASP.NET, Flash, and JavaScript', 'http://johndyer.name/', 'http://johndyer.name/syndication.axd', 'contact', 3 );
INSERT INTO be_BlogRollItems ( BlogRollId, Title, Description, BlogUrl, FeedUrl, Xfn, SortIndex )
VALUES ( '7f906880-4316-47f1-a934-1a912fc02f8b', 'Russell van der Walt', 'an adventure in web technologies', 'http://blog.ruski.co.za/', 'http://feeds.feedburner.com/rusvdw', 'contact', 4 );
INSERT INTO be_BlogRollItems ( BlogRollId, Title, Description, BlogUrl, FeedUrl, Xfn, SortIndex )
VALUES ( '890f00e5-3a86-4cba-b85b-104063964a87', 'Ben Amada', 'adventures in application development', 'http://allben.net/', 'http://feeds.feedburner.com/allben', 'contact', 5 );
INSERT INTO be_Categories (CategoryID, CategoryName)
VALUES ('ffc26b8b-7d45-46e3-b702-7198e8847e06', 'General');
INSERT INTO be_Posts (PostID, Title, Description, PostContent, DateCreated, DateModified, Author, IsPublished)
VALUES ('daf4bc0e-f4b7-4895-94b2-3b1413379d4b',
'Welcome to BlogEngine.NET 1.6 using MySQL',
'The description is used as the meta description as well as shown in the related posts. It is recommended that you write a description, but not mandatory',
'<p>If you see this post it means that BlogEngine.NET 1.6 is running with MySQL and the DbBlogProvider is configured correctly.</p>
<h2>Setup</h2>
<p>You are configured to have your user names and passwords stored in MySQL by default. It is time to setup some users. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. You should also see a link to a Change Password page. You should use this to change the default password right away.</p>
<h2>Write permissions</h2>
<p>Since you are using MySQL to store your posts, most information is stored there. However, if you want to store attachments or images in the blog, you will want write permissions setup on the App_Data folder.</p>
<h2>On the web </h2>
<p>You can find BlogEngine.NET on the <a href="http://www.dotnetblogengine.net">official website</a>. Here you will find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at <a href="http://blogengine.codeplex.com/">CodePlex</a> where the daily builds will be published for anyone to download.</p>
<p>Good luck and happy writing.</p>
<p>The BlogEngine.NET team</p>',
CURDATE(),
CURDATE(),
'admin',
1);
INSERT INTO be_PostCategory (PostID, CategoryID)
VALUES ('daf4bc0e-f4b7-4895-94b2-3b1413379d4b', 'ffc26b8b-7d45-46e3-b702-7198e8847e06');
INSERT INTO be_PostTag (PostID, Tag)
VALUES ('daf4bc0e-f4b7-4895-94b2-3b1413379d4b', 'blog');
INSERT INTO be_PostTag (PostID, Tag)
VALUES ('daf4bc0e-f4b7-4895-94b2-3b1413379d4b', 'welcome');
INSERT INTO be_Users (UserName, Password, LastLoginTime, EmailAddress)
VALUES ('Admin', '', CURDATE(), 'email@example.com');
INSERT INTO be_Roles (Role)
VALUES ('Administrators');
INSERT INTO be_Roles (Role)
VALUES ('Editors');
INSERT INTO be_UserRoles (UserID, RoleID)
VALUES
( (SELECT UserID FROM be_Users WHERE UserName = 'Admin'),
(SELECT RoleID FROM be_Roles WHERE Role = 'Administrators'));
INSERT INTO be_DataStoreSettings (ExtensionType, ExtensionId, Settings)
VALUES (1, 'be_WIDGET_ZONE', '<?xml version="1.0" encoding="utf-16"?><WidgetData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Settings><widgets><widget id="d9ada63d-3462-4c72-908e-9d35f0acce40" title="TextBox" showTitle="True">TextBox</widget><widget id="19baa5f6-49d4-4828-8f7f-018535c35f94" title="Administration" showTitle="True">Administration</widget><widget id="d81c5ae3-e57e-4374-a539-5cdee45e639f" title="Search" showTitle="True">Search</widget><widget id="77142800-6dff-4016-99ca-69b5c5ebac93" title="Tag cloud" showTitle="True">Tag cloud</widget><widget id="4ce68ae7-c0c8-4bf8-b50f-a67b582b0d2e" title="RecentPosts" showTitle="True">RecentPosts</widget></widgets></Settings></WidgetData>');
接下来,我们需要使用已经配置好MySQL数据库引擎的web.config 文件,您可以直接拷贝如下文件到您的web.config 中。
<configuration>
<configSections>
<sectionGroup name="BlogEngine">
<section name="blogProvider" requirePermission="false" type="BlogEngine.Core.Providers.BlogProviderSection, BlogEngine.Core" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
</sectionGroup>
</configSections>
<BlogEngine>
<blogProvider defaultProvider="DbBlogProvider">
<providers>
<add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
<add name="DbBlogProvider" type="BlogEngine.Core.Providers.DbBlogProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
</providers>
</blogProvider>
</BlogEngine>
<connectionStrings>
<clear/>
<add name="BlogEngine" connectionString="Server=MySqlServer;Database=blogengine;Uid=beUser;Pwd=password;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<appSettings>
<add key="BlogEngine.FileExtension" value=".aspx"/>
<!-- You can e.g. use "~/blog/" if BlogEngine.NET is not located in the root of the application -->
<add key="BlogEngine.VirtualPath" value="~/"/>
<!-- The regex used to identify mobile devices so a different theme can be shown -->
<add key="BlogEngine.MobileDevices" value="(nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)"/>
<!-- The name of the role with administrator permissions -->
<add key="BlogEngine.AdminRole" value="Administrators"/>
<!--This value is to provide an alterantive location for storing data.-->
<add key="StorageLocation" value="~/App_Data/"/>
<!--A comma separated list of script names to hard minify. It's case-sensitive. -->
<add key="BlogEngine.HardMinify" value="blog.js,widget.js,WebResource.axd"/>
</appSettings>
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<system.web>
<compilation debug="false">
<assemblies>
<add assembly="MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto"/>
<httpRuntime enableVersionHeader="false" useFullyQualifiedRedirectUrl="true" maxRequestLength="16384" executionTimeout="3600" requestLengthDiskThreshold="16384"/>
<machineKey validationKey="D9F7287EFDE8DF4CAFF79011D5308643D8F62AE10CDF30DAB640B7399BF6C57B0269D60A23FBCCC736FC2487ED695512BA95044DE4C58DC02C2BA0C4A266454C" decryptionKey="BDAAF7E00B69BA47B37EEAC328929A06A6647D4C89FED3A7D5C52B12B23680F4" validation="SHA1" decryption="AES"/>
<authentication mode="Forms">
<forms timeout="129600" name=".AUXBLOGENGINE" protection="All" slidingExpiration="true" loginUrl="~/login.aspx" cookieless="UseCookies"/>
</authentication>
<pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true">
<controls>
<add namespace="Controls" tagPrefix="blog"/>
</controls>
</pages>
<customErrors mode="RemoteOnly" defaultRedirect="~/error404.aspx">
<error statusCode="404" redirect="~/error404.aspx"/>
</customErrors>
<membership defaultProvider="DbMembershipProvider">
<providers>
<clear/>
<add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core" description="XML membership provider" passwordFormat="Hashed"/>
<add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
<add name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" passwordFormat="Hashed" connectionStringName="BlogEngine"/>
</providers>
</membership>
<roleManager defaultProvider="DbRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
<providers>
<clear/>
<add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider"/>
<add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
<add name="DbRoleProvider" type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
</providers>
</roleManager>
<siteMap defaultProvider="PageSiteMap" enabled="true">
<providers>
<add name="PageSiteMap" description="The site map provider that reads in the .sitemap XML files." type="BlogEngine.Core.Web.Controls.PageSiteMap, BlogEngine.Core"/>
<add name="SecuritySiteMap" description="Used for authenticated users." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" securityTrimmingEnabled="true" siteMapFile="Web.sitemap"/>
</providers>
</siteMap>
<httpModules>
<add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core"/>
<add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core"/>
<add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core"/>
<add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core"/>
<!--Remove the default ASP.NET modules we don't need-->
<remove name="PassportAuthentication"/>
<remove name="Profile"/>
<remove name="AnonymousIdentification"/>
</httpModules>
<httpHandlers>
<add verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core" validate="false"/>
<add verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="js.axd" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="sioc.axd" type="BlogEngine.Core.Web.HttpHandlers.Sioc, BlogEngine.Core" validate="false"/>
<add verb="*" path="apml.axd" type="BlogEngine.Core.Web.HttpHandlers.Apml, BlogEngine.Core" validate="false"/>
<add verb="*" path="foaf*.axd" type="BlogEngine.Core.Web.HttpHandlers.Foaf, BlogEngine.Core" validate="false"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<!-- Enable the staticContent section below to add Expires headers to images for better performance.
Some hosting providers does not allow the staticContent section to be set. -->
<!--
<staticContent>
<clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>
-->
<modules>
<add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core"/>
<add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core"/>
<add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core"/>
<add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core"/>
</modules>
<handlers accessPolicy="Read, Write, Script, Execute">
<add name="FileHandler" verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="ImageHandler" verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Syndication" verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Sitemap" verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Trackback" verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Pingback" verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="OpenSearch" verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="MetaWeblog" verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="RSD" verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="CssHandler" verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Javascript" path="js.axd" verb="*" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Rating" verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Opml" verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="BlogML" verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="SIOC" verb="*" path="sioc.axd" type="BlogEngine.Core.Web.HttpHandlers.Sioc, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Apml" verb="*" path="apml.axd" type="BlogEngine.Core.Web.HttpHandlers.Apml, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
<add name="Foaf" verb="*" path="foaf*.axd" type="BlogEngine.Core.Web.HttpHandlers.Foaf, BlogEngine.Core" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode"/>
</handlers>
<!-- Enable the httpProtocol section below to manipulate some HTTP headers.
Some hosting providers does not allow the httpProtocol section to be set. -->
<!--
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="Etag" value=" " />
</customHeaders>
</httpProtocol>
-->
</system.webServer>
</configuration>
您只需要修改其中的数据库地址即可,方法是把
中的MySQLServer 修改为您的数据库地址,默认是 localhost:3306,beUser修改为您的用户名,password修改为您的数据库密码,好了,现在,您的博客引擎已经可用了。