MySQL is an open-source, relational database management system.

learn more… | top users | synonyms

1
vote
1answer
711 views

Bad Request (Invalid Hostname) on working server, database problem

I have a local server up using EasyPHP. I know its working because I have a default wordpress install running and up on my brower. I have a full site which I also know I have working because when I ...
1
vote
1answer
218 views

Mysql query and order meta value

I made a mysql query to WordPress like this: $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND ...
1
vote
1answer
873 views

How can I debug my database connection for unit testing?

I've set up a wordpress environment on my Mac with MAMP and I'm running 3.5.1 locally (i.e. http://localhost:8888/blog works). I'm trying to run the unit test suit from wordpress.org and having ...
1
vote
2answers
556 views

Error establishing database connection - high traffic?

I have a WordPress 3.5.1 site that's getting a little bit of traffic (80 concurrent visitors, ~5 clicks/pageviews per second). The site runs fine until it spikes to ~85 visitors. There are usually 4 ...
1
vote
2answers
962 views

MySQL Syntax Error upon restoring database from backup [closed]

Performed a bad import to my Wordpress install and decided to restore from the mqSQL backup (full export) I had made minutes earlier. Dropped all tables in the database and then did an import from my ...
1
vote
1answer
75 views

Pushing stored procedure to a multisite database in WordPress

I am given a WordPress multisite and need to extract information from the site. I have written a stored procedure that recursively builds a tree relationship for posts of a certain kind. Now I am ...
1
vote
1answer
225 views

Custom MySQL Query with logic

I have wp e-commerce plugin installed and custom building custom global search My query looks like this SELECT * FROM aka_v_posts LEFT JOIN aka_v_postmeta ON aka_v_posts.ID=aka_v_postmeta.post_id ...
1
vote
1answer
80 views

Delete all one-word comments

I'm trying to delete all wordpress comments with only one word. I found this mysql query to delete all comments at once, but that's not what I want to achieve: DELETE FROM wp_comments WHERE ...
1
vote
2answers
711 views

wpdb->prepare function remove single quote for %s in SQL statment

I am using the below wpdb->prepare function in a sql statement. I am passing in several variables some field names and some values. When I try to use the %s for the field name it puts single quotes ...
1
vote
2answers
146 views

How to simultaneously access the same MySQL database in the main column and sidebar of Wordpress?

I've wrote some basic custom PHP code for my Wordpress site. The code basically access a MySQL database (a different database from the wordpress database) and displays the information. In addition to ...
1
vote
2answers
2k views

Is It Possible to Restore Accidentally Deleted Widgets?

I accidentally deleted the widgets without dragging it to the inactive widgets section. I have a backup of all the files and the database but i have changed many things on the site other than the ...
1
vote
1answer
607 views

Help with WP_Query - Too many mySQL queries

I need some kind of help with wp_query. Am I doing something wrong? I am getting a lot of mySQL queries, while building a new theme. My WP_Query is: <?php $args = array( 'post_type' => ...
1
vote
1answer
124 views

how would I create a custom query to get all users, and a related post based on a postmeta field?

I have about 50 users. Its pretty easy to list them all. However they are related to a special custom post type through a postmeta field called wpp_agents. So I need to list Users, but also the ...
1
vote
1answer
1k views

Increment value (value = value+1) of $wpdb->update

This sql query $wpdb->query("UPDATE log SET total=total+1 WHERE id='1')"); How do I turn it into $wpdb->update() statement? Ex. $wpdb->update('log', array('total'=>'total+1'), ...
1
vote
1answer
455 views

How to split the a table in database?

Is there any option to split the tables in more tables in different databases? The problem is that my the wp_posts table is to big and it takes a lot of time to show in the Dashboards... (more than 20 ...
1
vote
1answer
294 views

Too many pages causes Wordpress admin to be unusable

We have a Wordpress website that now has around 9k pages in it after an import of many location targeted pages. The frontend runs perfectly fine and there is no performance damage (after I replaced ...
1
vote
1answer
1k views

Accessing WordPress MySQL Database via Data Connection in Visual Studio 2010 using C#

So I've Googled and followed countless tutorials, read documentation on MySQL, Visual Studio, WordPress, and Plesk. I try to leave posting on this site as the final option and it seems it has come to ...
1
vote
2answers
2k views

Help with MySQL to $WPDB query

Here's my issue. I have three tables I'd like to query - states, points, and state_points. States contains stateid, and name. Points: pointid, pointlat, pointlng. State_points: Stateid, Pointid. ...
1
vote
1answer
584 views

Using GROUP CONCAT in my-sql query with wp_usermeta table

I have a query that is meant to return user details from Wordpress tables. It would be fine if I was just SELECTing column names that I want, but within Wordpress there is a usermeta table which has 2 ...
1
vote
2answers
505 views

wpdb Custom Meta Data with 2 conditions

This is one of those problems that I've spent way too much time on, and there is probably a VERY simple solution that I am missing. Any help would be greatly appreciated. I am trying to populate a ...
1
vote
3answers
2k views

Help With MySQL to WPDB Query Conversion

I have a problem. I've got a PHP script that tracks individual file downloads, and I'm looking for a way to display that number in individual posts. I've got a half-baked solution- a plain ol' MySQL ...
1
vote
1answer
316 views

Query to import data from one MultiSite table to another (pages/sub-pages)

I'm updating a standard install with about 500 (eek!!) pages to a MultiSite for easier sub-site management. I basically want to take a sub-page and its children from the root site and copy the data ...
1
vote
1answer
457 views

MySQL Query To Select Post By Postmeta

I have two custom post types, type1 and type2. Type2 posts have a postmeta called postID that is the ID number of a post in type1. When showing type1 in single.php I want a mysql query that selects ...
1
vote
1answer
123 views

MySQL Rank & $wpdb

I need a rank column in my MySQL statement, for example: SET @rank=0; SELECT @rank:=@rank +1 as rank, player, points FROM my_table Is there a way to use the above with $wpdb? WordPress doesn't ...
1
vote
2answers
207 views

Help running a MySQL query to update all wp_#_options tables in a Multisite install

I'd like to run a query through my WordPress database that updates the blog_public values on all individual sites. I'm stuck on how to have the statement look for wp_2_options, wp_3_options, etc. I ...
1
vote
1answer
487 views

User management system similar to wordpress one?

I am in very big need of a user management system just like the one that wordpress uses but without being blog related. I need to be able to manage users and apply certain privileges depending on user ...
1
vote
1answer
449 views

Importing Geo data into wordpress database

I have a listing wordpress site and want to integrate geo data into the Wordpress MySQL Database for custom search functionality I want to utilize different aspects to create different things... ...
1
vote
1answer
3k views

How to Mirror WordPress database from Remote server to Local server

Before I embark on this tutorial from the WordPress Codex on mirroring a WordPress database from a remote server to a local one. I'd like to get some feedback from SE users who have successfully ...
1
vote
1answer
944 views

SQL query to delete comments older than 90 days?

I'm working on a site that has 150,000 comments with an obvious hit in performance; is there an SQL query that can delete all comments older than say 90 days? They're not spam comments, and they are ...
1
vote
3answers
181 views

Recent comments from my blogs only

I'd like to create a list of recent comments, specific to each user on my network (Buddypress). My best idea so far is pretty lame: DB Query on all user's blogs, compare dates, select top 10 by date. ...
1
vote
1answer
3k views

SQL query to select posts from multiple categories

I have built a query to select posts within a category. Works fine. But when I choose to add a secondary filter to exclude a category, the query return the same result set, as if the secondary ...
1
vote
1answer
18 views

Obtaining user table for one site on multisite set up

I'm trying to select only users that are registered for a specific site on my multisite set up and see that the table for the users has collected everyone that is on the network. Is there away I can ...
1
vote
0answers
25 views

Problems accesing my site [closed]

I was building a new site with WP, but when I checked it with various servers on http://www.host-tracker.com/InstantCheck, most of the request are returning with a 503 error. In addition my memory ...
1
vote
0answers
39 views

Slow wp-admin due to “SELECT DISTINCT post_mime_type FROM wp_posts WHERE post_type = 'attachment'”

The media library on a large site is slow in wp-admin. I did some research by looking into slow queries in the sql and found that this query is causing the slow response: SELECT DISTINCT ...
1
vote
1answer
61 views

No wp-config.php file on local install of wordpress - site still displays

I've installed Wordpress locally using XAMPP and this step by step guide by Sunny Johal(Fifth post down on that page). The first time I used the step by step and ran all 3 of the SQL codes(UPDATE ...
1
vote
0answers
95 views

Slow meta_query with about 4 milion record on wp_postmeta

Although optimized wordpress all the way but still very slow as follows : I have converted from LONGTEXT meta_value field to TEXT Then create INDEX for this field ALTER TABLE wp_postmeta ADD INDEX ...
1
vote
1answer
46 views

Why does dbDelta() not catch MysqlErrors?

From what I can see, dbDelta() is designed to suppress database errors that occur during its operation. Generally speaking, this seems to be the case, but New Relic is still reporting MysqlErrors ...
1
vote
0answers
50 views

Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin

I have a wordpress table like so (phpmyadmin and MySQL) | id | meta_key | meta_value | +----+-----------+------------+ | 1 | import_id | abc | | 2 | import_id | abc | | 3 | ...
1
vote
1answer
254 views

How to count post meta key values for all posts in database

In my post meta data I have the following 'key' for every post: "image_details" a typical value of which is an array such as: ...
1
vote
1answer
66 views

$wpdb->wp_users returning empty value for

I have a code Example: function custom_func(){ global $wpdb; $wpdb->flush(); //tried with and without this line $getTest = 'SELECT * FROM $wpdb->wp_users LIMIT 1'; ...
1
vote
0answers
43 views

Calculate average crossing post categories

In my WP database I have some posts i the category hotels and some other posts in the category visits. In the posts (placed in the category visits) there is two meta_fields ( rating and placeid ) ...
1
vote
0answers
37 views

Writing into MySQL Table

I'm trying to write some data from the frontend into a custom database table. As long there is no value in the input field this script creates an empty line in the database table, but if the input ...
1
vote
1answer
93 views

Query Wordpress database by registered date and role

I would like to get the display name and email address for all users who have registered to my multisite today with the role of subscriber. It needs to be an SQL query as it's used outside of the WP ...
1
vote
1answer
542 views

wpdb prepare syntax

$arr = []; array_push( $arr, 'wp_table', 1, '2013-12-24', 3, 'NULL'); $sql_prepare = "INSERT INTO %s (id, datea, one, two) VALUES (%d, %s, %d, %s) ON DUPLICATE KEY UPDATE one = VALUES(one), two = ...
1
vote
0answers
134 views

How to track a users progress through pages by inserting data into Wordpress Database?

My website users can learn British Sign Language through Video Tuts, Quizzes and games etc. I would like to track the users progress through the pages of the course and add that data to a Wordpress ...
1
vote
1answer
377 views

Large Woocommerce Site (83,000 items), What Can I Do? [closed]

So I have a really large woocommerce site (partsboss.co) that has around 83,000 items. It's on VPS hosting with digitalocean, and things were running super fast until around 50,000 items. Now the ...
1
vote
1answer
122 views

Separate DB by yearly archive of Wordpress

I have large DB of blog post I already export it by year and wanted to make archive by year doing it on subdomain, like 2012.mysite.com I stack looking for solution on internet, I wondering if their ...
1
vote
0answers
401 views

$wpdb->insert() does not Insert record in a table

I'm trying to understand and get hold of the $wpdb global object but can't seem to make it work. Basically, I'm trying to insert a single record into a custom table in wordpress DB. Instead of ...
1
vote
0answers
156 views

Wordpress running SQL query to update database from form

Basically I want to take information in from a form and use a separate php page to update the database. so here is the original wordpress php page (add_person.php): <?php /* Template Name: ...
1
vote
3answers
432 views

Site running slow on new server?

I recently uploaded a website to a new 123-reg server on a single WP installation (www.moseleycoachsales.co.uk). I had developed the site on my own hosted multisite environment ...