Why doesn’t custom mysql query return results? Is syntax correct?

You’re including the table prefix, but $wpdb takes care of that. Change: $query = $wpdb->prepare( “SELECT * FROM $wpdb->wp_terms INNER JOIN $wpdb->wp_term_taxonomy ON ($wpdb->wp_terms.term_id = $wpdb->wp_term_taxonomy.term_id) WHERE $wpdb->wp_terms.name LIKE %s AND $wpdb->wp_terms.count > 0”, $wpdb->esc_like($keyword) . ‘%’); To: $query = $wpdb->prepare( “SELECT * FROM $wpdb->terms INNER JOIN $wpdb->term_taxonomy ON ($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id) WHERE $wpdb->terms.name LIKE … Read more

Where is my mysql log on OS X?

As Chealion mentioned, there are several ways that your mysql could have been installed. Each of which will place your data dir and/or logs in different locations. The following command will give you (and us) a good indication of where to look. ps auxww|grep [m]ysqld # Putting brackets around the first char is a `grep`+`ps` … Read more

MySQL: How to change url in posts from xxx.com to yyy.org?

Instead of replace url directly in mysql db Try with Velvet Blues Update URLs wordpress plugin. It is safe to use this plugin. Because mysql db has some serialize values for post meta key. In that case your solution will not work proper. I had used velvet blue update urls plugin many times while migrating … Read more

Migration problems with mysql: Operation not allowed when innodb_forced_recovery > 0 [closed]

Commenting out the line innodb_force_recovery = 1 in /etc/my.cnf thus: # innodb_force_recovery = 1 made the mysql innodb tables in the database accessible. Apparently this setting causes innodb to become read-only. I hope this helps someone in the future. If you don’t have access to /etc/my.cnf on shared hosting, ask your host to fix it … Read more

How to insert dash (-) into database using wpdb and new_to_publish hook?

When we call get_the_title(), then the post title is taken through the wptexturize() function via the the_title filter: add_filter( ‘the_title’, ‘wptexturize’ ); The en-dash and em-dash are replaced with /* translators: en dash */ $en_dash = _x( ‘–’, ‘en dash’ ); /* translators: em dash */ $em_dash = _x( ‘—’, ’em dash’ ); A simple … Read more

How can I show mysql locks?

See Marko’s link for InnoDB tables and the caveats. For MyISAM, there isn’t a dead easy “this is the offending query” solution. You should always start with a processlist. But be sure to include the full keyword so that the printed queries aren’t truncated: SHOW FULL PROCESSLIST; This will show you a list of all … Read more

Sql – Search with serialized Data / better database concept

Use the relational database for its intended purpose – create the separate table. The rich set of time/date functionality available in your SQL queries for this example, is well worth it. Sticking searchable/reportable data into a serialized column in the database should be the last resort not the first 😉