Tag Archives: mysql

wordpress url change mysql code

I changed the url of my blog again recently here is some helpful mysql code to renaming a wordpress blog url. YMMV. You’ll need to find all the other fields which containd the old information. I’d like this to be a plugin, it’s more or less a set of simple database commands, but for now cut and paste code will work ok.

 
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'blog.blog.px.ns1.net','blog.px.ns1.net');# MySQL returned an empty result set (i.e. zero rows).
 
UPDATE `wp_comments` SET `comment_author_url` = REPLACE(`comment_author_url`,'blog.blog.px.ns1.net','blog.px.ns1.net');# MySQL returned an empty result set (i.e. zero rows).
 
UPDATE `wp_options` SET `option_value` = REPLACE(`option_value`,'blog.blog.px.ns1.net','blog.px.ns1.net');# MySQL returned an empty result set (i.e. zero rows).
 
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'https://px.ns1.net','http://blog.px.ns1.net:81');
 
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'http://px.ns1.net:81','http://blog.px.ns1.net:81');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'/wordpress','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,':81//',':81/');
UPDATE `wp_xspf_player` SET `url` = REPLACE(`url`,'https://px.ns1.net','http://blog.px.ns1.net:81');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'https://px.ns1.net/','http://blog.px.ns1.net:81/');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'http://px.ns1.net:81/','http://blog.px.ns1.net:81/');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'/wordpress/wordpress/','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,"[php]","<pre lang=\"php\">");
 
 UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,"[/php]","</pre>");

update:

UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'/wordpress/wordpress/','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'/wordpress/','/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'http://px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`,'http://blog.px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_posts` SET `pinged` = REPLACE(`pinged`,'ns1.net/wordpress/','ns1.net/');
UPDATE `wp_posts` SET `pinged` = REPLACE(`pinged`,'http://px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_posts` SET `pinged` = REPLACE(`pinged`,'/wordpress/wordpress/','/');
 
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`,'http://blog.px.ns1.net:81/','http://blog.px.ns1.net/');
 
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'http://px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'http://blog.px.ns1.net:81//','http://blog.px.ns1.net/');
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'http://blog.px.ns1.net:81/','http://blog.px.ns1.net/');
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`,'/wordpress','/');
 
UPDATE `wp_options` SET `option_value` = REPLACE(`option_value`,':81','');

[tags]mysql, wordpress, wordpress database, mysql code, code, examples, URL, change, tables, fields, rename, replace, blog, mysql code,cut and paste, database commands [/tags]

ugh, wordpress broke.

OK, well something broke after my Twas the Night Before Christmas post..

WordPress database error: [You have an error IN your SQL syntax; CHECK the manual that corresponds to your MySQL server version for the RIGHT syntax to USE near 'AND post_status = 'publish' AND DATE_SUB(CURDATE(),INTERVAL 90 DAY) < ' at line 9]
SELECT ID, ( (5 * (MATCH (`post_title`) AGAINST ('pain' IN BOOLEAN MODE))) + (3 * (MATCH (`post_excerpt`) AGAINST ('pain' IN BOOLEAN MODE))) + (1 * (MATCH (`post_content`) AGAINST ('pain' IN BOOLEAN MODE))) ) AS `relevance` FROM `wp_posts` WHERE ( MATCH (`post_title`, `post_excerpt`, `post_content`) AGAINST ('pain' IN BOOLEAN MODE)) AND ID != AND post_status = 'publish' AND DATE_SUB(CURDATE(),INTERVAL 90 DAY) <= post_modified HAVING `relevance` >= 5 ORDER BY `relevance` DESC LIMIT 1

[update]
OK the aLinks wordpress plugin was the culprit. It kept catching the keyphrase ‘pain’ for some reason, and decided it did not like it.

[tags]wordpress, broken, this is broken, mysql, SQL,fixed, alinks, wordpress plugin[/tags]

Aggregator Showdown.

I started writing this last week, but with a lack of energy, here’s the skinny on what I’ve written up.

Dave Winer reminds us the other day. “2/3/06: “Aggregator developers could sure use some competition!
I like server side aggregators more than desktop. In a multi-user aggregator ideally it should be customizable by the end-user. One that shows you your feeds how you like to view them, whether it be email style, linear, reverse, upside down, reverse print, etc.
It should also remembers what’s new since the last visit.
I decided I’d see just what the opensource world has to offer in web-based single and multi-user aggregators.
I really wasn’t too impressed from a selection point of view with a multi-user installation in mind.
most opensource aggregators aren’t “pretty” or even still in development.
2004 was last real opensource aggregator development time period.
I even tried to get some of the ones listed in google’s directory to work.
here is some of my results in demo form.

DATE NAME Code Users? In Devel? OPML? Working?
2004.02.14 rnews php single no yes yes - with manual fix
2004.11.06 TALAggregator python single no yes no
2004.08.08 planet python single no no not latest dev version
2004.12.16 feedonfeed php single no import yes

Installation notes.
I first tried the Gentoo ebuild version of planet which is quite old but worked. planet has a nightly snapshot of their devel repo, which is missing a python dependancy I can’t figure out.

TALAggregator lacks a logout button, which makes it difficult to create users, and use your own account to browse feeds. Also logging in doesn’t usually work properly. TALAggregator stores it’s password in an encrypted format in the mysql database.

rnews stores the passwords as plaintext in the mysql database and also lacks a logout button/link. It is also having issues when creating it’s tables in the database. Being able to create the user_prefs table, but not the links, and users’ links table. ex. “links”, “px_links”

Once I applied some force and a crowbar, I now have the sql to create the needed table. It’s support with importing of opml files works fine and also adds your categorized material correctly. And of course the interface is a tad bit clunky.

CREATE TABLE `links` (
`id` INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`src_id` VARCHAR( 36 ) NOT NULL ,
`link` TEXT NOT NULL ,
`title` TEXT NOT NULL ,
`description` TEXT NOT NULL ,
`state` VARCHAR( 16 ) NOT NULL ,
`pubdate` DATETIME NOT NULL ,
UNIQUE (
`src_id` ,
title( 255 )
)
) ENGINE = MYISAM
CREATE TABLE `px_links` (
`id` INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` TEXT NOT NULL ,
`main_link` TEXT NOT NULL ,
`rss_link` TEXT NOT NULL ,
`image_url` TEXT NOT NULL ,
`user_order` INT( 8 ) NOT NULL ,
`category` TEXT NOT NULL ,
`last_update` DATETIME NOT NULL
) ENGINE = MYISAM ;

Bad Behavior has blocked 819 access attempts in the last 7 days.

>>>>>>> .r246