I want to change user role from the database,

UPDATE wp_usermeta
SET meta_value = 'a:1:{s:10:"subscriber";b:1;}' 
WHERE meta_key = 'wp_capabilities' 
AND meta_value = 'a:1:{s:9:"wpas_user";b:1;}';

but I get an error.

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''a:1:{s:10:"subscriber")' at line 1

  • Is that the exact code you're running? I didn't receive any error when I ran that query. – Jacob Peattie May 30 '19 at 8:09
  • sure http://s8.picofile.com/file/8362076834/ttttt.PNG – D.JCode May 30 '19 at 8:12
  • @JacobPeattie I found the problem. it cause two ;. how can I solve that? – D.JCode May 30 '19 at 8:27

Found it.

It was a field in phpMyAdmin which is set to a semicolon(;) by default.

I have changed it to an unused char and the query ran normally.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.