Posts Tagged ‘mysql’

MySQL InnoDB table truncate fails because of foreign keys

Thursday, April 12, 2012 8:51 No Comments

If trying to truncate MySQL InnoDB tables and you are getting an error because of foreign keys constraints try disabling the foreign keys checks. SET FOREIGN_KEY_CHECKS = 0; .. TRUNCATE tableName; TRUNCATE tableName2; .. SET FOREIGN_KEY_CHECKS = 1;

This was posted under category: Database Tags: , , , ,

Move WordPress to a new domain / location

Tuesday, May 25, 2010 0:25 No Comments

How to move WordPress to a new location in few steps. – move files, addapt .htaccess, wp-config.php if needed - backup database – run the following queries (replace old_url.tld, new_url.tld with actual data)   UPDATE wp_options SET option_value = replace(option_value, ‘http://www.old_url.tld’, ‘http://www.new_url.tld’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE wp_posts SET guid = replace(guid, [...]

This was posted under category: Wordpress Tags: , , , ,

MySQL – Get the Top N of a Group

Friday, March 26, 2010 11:43 No Comments

Getting Top N of a group would be very easy if there just wasn’t that ‘LIMIT & IN/ALL/ANY/SOME subquery’ restriction. But there’s always some way around. Thx to Jon Armstrong from A little Noise for the code hint. MYSQL table ‘measurements’ | Id | Freq | Level | DateM ## Gets the last 2 measurements [...]

This was posted under category: Database Tags: , , , , , , , ,

MYSQL – Disabling FULLTEXT Search stopwords

Friday, January 15, 2010 0:38 1 Comment

To disable MySQL FULLTEXT Search stopwords open the mysql config file and below [mysqld] add the following line: ft_stopword_file = “” By setting the ft_stopword_file value to an empty string the usual stopwords won’t be ignored any more. Here is what the manual says about setting a new stopwords file: To override the default stopword [...]

This was posted under category: Database Tags: , , , , ,

MySQL – How to change the FULLTEXT SEARCH 4 character minimum behaviour

Thursday, January 14, 2010 23:56 No Comments

By default the FULLTEXT minimum characters behaviour is set to 4 characters. To check what value is preset on your server type the following query: SHOW VARIABLES LIKE ‘ft%’; That shoud bring up a result similar to this: Variable_name Value ft_boolean_syntax + -><()~*:””&| ft_max_word_len 84 ft_min_word_len 4 ft_query_expansion_limit 20 ft_stopword_file (built-in) To change the ftp_min_word_len [...]

This was posted under category: Database Tags: , , , , , , , ,