Site paths broken in wordpress on new server? SQL query - sql

I am trying to migrate a wordpress website to a new server, which is on mediatemple.
In there migration guide, it suggests updating the site preview/paths to the IP of the server.
It gives a SQL query to run in phpMyAdmin which is:
UPDATE `dbname`.`wp_options` SET `option_value` = 'http://xxx.xxx.xxx.xxx' WHERE `wp_options`.`option_id` =1 AND `wp_options`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = 'siteurl' LIMIT 1 ;
But can't get it to work as it reports an error when I run it.
This is the updated query inputted with my details:
UPDATE `db87924`.`db87924_rockhaq` SET `option_value` = 'http://64.207.145.39' WHERE `wp_options`.`option_id` =1 AND `db87924_rockhaq`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = 'siteurl' LIMIT 1 ;
I'm guessing that 'option_value', 'wp_options', 'option_id' and 'option_name' need to be replaced with something but have no idea what and can't find any more info on it.
If anyone has any ideas, that would be great!
Thanks

Always backup the database in case something goes awry. :D
This is the query I would use to migrate the WP install and has worked for me so far (might be different for you):
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='siteurl';
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='home';
However, if your WP install hosts more than 1 blog, then I would update the query to:
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='siteurl' AND blog_id=0;
UPDATE wp_options SET option_value='http://64.207.145.39' WHERE option_name='home' AND blog_id=0;
These change the paths/links in Wordpress (in my experience, both settings need to be changed: home and siteurl).
If this works, you would probably need to run the query again when the DNS is transferred.

wp-config.php might also has some hardcoded paths which need to be changed.
http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29

Related

What is wrong in these steps regarding to connecting metabase and ldap?

I am not able to create connection between metabase and LDAP.
I am trying to set it up similar with our Zeppelin configuration:
ldapRealm.contextFactory.url = our_url<br>
ldapRealm.contextFactory.systemUsername = our_username<br>
ldapRealm.contextFactory.systemPassword = our_password
ldapRealm.userDnTemplate = cn={0},ou=people,dc=xha,dc=app<br>
ldapRealm.memberAttributeValueTemplate = cn={0},ou=people,dc=xha,dc=app<br>
ldapRealm.authorizationEnabled = true<br>
ldapRealm.searchBase = dc=xha,dc=app<br>
ldapRealm.userSearchBase = ou=people,dc=xha,dc=app<br>
ldapRealm.groupSearchBase = ou=group,dc=xha,dc=app<br>
ldapRealm.userSearchAttributeName = uid<br>
ldapRealm.userSearchFilter = (&(objectclass=*)(uid={0}))<br>
ldapRealm.memberAttribute = memberUid
When I tried similar configuration:
URL, Username, Password, worked well.
I tried use “ou=people,dc=xha,dc=app” for “USER SEARCH BASE”, but it did not work and I get error in log:
errors {:ldap-user-base "User search base does not exist or is
unreadable"}}
So it seems, that “USER SEARCH BASE” is in reality “GROUP SEARCH BASE”.
The only one value which working in “USER SEARCH BASE” is “OU=group,DC=xha, DC=app”
I tried for “USER FILTER”:<br>
cn={login},ou=people,dc=xha,dc=app<br>
(&(objectClass=)(uid={0}))<br>
(&(objectClass=)(uid={login}))<br>
(&(objectClass=)(memberUid={0}))<br>
(&(objectClass=)(memberUid={login}))<br>
{uid={login}}<br>
(&(objectclass=*)(cn={login}))<br>
I also tried with empty filter.
Nothing works yet and I am stuck on this for like 2 weeks.
In log is just:
{:errors {:password “did not match stored password”}}
I also tried steps in https://discourse.metabase.com/t/ldap-debugging/2741 but I am still not able to make it work.
Our “LDAP” accounts have no email -> https://discourse.metabase.com/t/autenticate-by-ldap-a-user-that-have-no-email/5215
I do not know if this is still “hardcoded” in version: 0.34.2
So, do you have any suggestions, how can I figured it out?
Thank you in advance
Peter
Actually I figured it out. "OU=people,DC=xha, DC=app" was correct, but our LDAP schema was huge and there were errors in LDAP's logs, that "SIZE LIMIT EXCEEDED". So we started using MariaDB for storing Metabase settings and I saved settings with "OU=group,DC=xha, DC=app" and then manually changed to OU=people,DC=xha, DC=appin MariaDB.

Solving a SQL 1064 error when trying to retrieve my password for a locally developed Wordpress site?

I am locally developing a Wordpress site and have forgotten my password. I went through myphpadmin to access the database and change it; however, I get a #1064 SQL error when I click 'edit' on my user entry.
The errant query is:
SELECT * FROM "db"."users" WHERE ;
When I change it to:
SELECT * FROM "db"."users" WHERE ID = 1;
...it returns my user entry in a list but does not open the graphical interface to edit it. When I then click 'edit' on the entry in the list, I once again get the 1064 SQL error because the query has reverted back to:
SELECT * FROM "db"."users" WHERE ;
How do I fix this so I can edit my password? Thanks in advance!
How about executing simple update:
UPDATE `db`.`users`
SET col_name_pass = HASH(pass) -- or clear text pass???
WHERE id = 1;

DokuWiki LDAP can't see any groups

We have just changed our domain after protracted name change (the name actually happened two years ago!) and our DokuWiki installation has stopped being able to see any groups and memberships.
The config has been updated to reflect the new server and DCs and login is working correctly, it is only the groups that aren't working.
$conf['auth']['ldap']['server'] = 'ldap://MYDC.mydomain.co.uk:389';
$conf['auth']['ldap']['binddn'] = '%{user}#mydomain.co.uk';
$conf['auth']['ldap']['usertree'] = 'dc=mydomain,dc=co,dc=uk';
$conf['auth']['ldap']['userfilter'] = '(userPrincipalName=%{user}#mydomain.co.uk)';
$conf['auth']['ldap']['mapping']['name'] = 'displayname';
$conf['auth']['ldap']['mapping']['grps'] = 'array(\'memberof\' => \'/CN=(.+?),/i\')';
$conf['auth']['ldap']['grouptree'] = 'dc=mydomain,dc=co,dc=uk';
$conf['auth']['ldap']['groupfilter'] = '(&(cn=*)(Member=%{dn})(objectClass=group))';
$conf['auth']['ldap']['referrals'] = '0';
$conf['auth']['ldap']['version'] = '3';
$conf['auth']['ldap']['debug'] = 1;
Obviously I have edited the doain name there, but for the life of me I can't see what's wrong here, It all worked fine yesterday on the old domain.
I should also state that this is an old version of DokuWiki that for various reasons I can't actually update.
The debug line gives me a "ldap search: success" line, but if I add "?do=check" onto any url within the system I get "You are part of the groups"...... and nothing, it can't see any groups.
It's a massive pain as we have a pretty intricate ACL setup for the site, so it's not like I can just throw it open to all.
If anyone has any suggestions, no matter how obvious, please pass them on.
Solved it by changing the dokuwiki authentication plugin that was used, the 'authad' is more simple to use and just works with what I'm doing.
As a side bonus it also means that I have finally been able to get the install upgraded to the current version.

Why is my ALTER SYSTEM command failing here?

A colleague gave me some code to run. I need to set the archive log location to a directory inside db_recovery_file_dest . I am using a VirtualBox VM , called "Oracle Developer Days"
I'm trying to run the following command :
ALTER SYSTEM SET log_archive_dest_1 = '/home' SCOPE=both;
But it's generating this error :
SQL> ALTER SYSTEM SET log_archive_dest_1 = '/home' SCOPE=both;
ALTER SYSTEM SET log_archive_dest_1 = '/home' SCOPE=both
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE
SQL>
What is the SPFILE ?
Also , could the problem be that I'm using a Virtual Machine ?
The correct syntax is ALTER SYSTEM SET log_archive_dest_1 = 'LOCATION=/home' SCOPE=both;. It's in the docs: find out more.
You shouldn't be setting it to /home. I hope that's a just a simplification you've made for posting here.
"What is the SPFILE ?"
You need to understand what you're doing. Please read the documentation and learn some basic concepts about the Oracle database and being a DBA. Find out more.
Which Oracle version are you using?
SPFILE stands for Server Parameter File (called PFILE prior to 9i release) it contains some parameters which is used by Oracle to initialize certain variables at the time when database is brought up.
You can use the below mentioned query to check where your server parameter (SPFILE) is stored.
show parameter spfile
Regards
Andy

Export CSV from phpMyAdmin after using SQL_BIG_SELECTS = 1

I have the following query which requires SET SQL_BIG_SELECTS = 1; to be run before it.
SET SQL_BIG_SELECTS = 1;
SELECT uc_products.nid, uc_products.model, uc_products.sell_price
FROM uc_products, node
WHERE node.status = 1
GROUP BY nid
This generates exactly what I need in phpMyAdmin. I need to export this as a CSV file but when I go to export, it loses the SET SQL_BIG_SELECTS = 1; part of the query and there's no way to add it back in. This means that in the CSV file, I'm getting an error message telling me to use SET SQL_BIG_SELECTS = 1; in order to run the query properly.
Has anyone come across this problem before or have any idea how to get around it?
You can set SQL_BIG_SELECTS in config file or at server startup. It can also be set on a session basis with 'SET SESSION SQL_BIG_SELECTS=1'.