This may come across as silly, but if the CMS ignores subsequent <!--more-->
tags, you shouldn't really care if it adds one after every </em>
closing tag. Sure it may make the posts slightly larger than they should be, but since they're just going to be ignored, it seems silly to spend two days trying to not do that when at the end of the day it doesn't really matter whether you do or not.
That said, I am not a MySQL guy, but looks like this is as decent an approach as any, from this StackOverflow answer:
UPDATE wp_posts
SET post_content = CONCAT(REPLACE(LEFT(post_content,
INSTR(post_content, '</em>')+4), '</em>', '</em><!--more-->'),
SUBSTRING(post_content, INSTR(post_content, '</em>') + 5))
WHERE INSTR(post_content, '</em>') > 0;
or the (slightly simpler):
UPDATE wp_posts
SET post_content = CONCAT(LEFT(post_content, INSTR(post_content, '</em>')-1),
'</em><!--more-->',
SUBSTRING(post_content, INSTR(post_content, '</em>')+ 5))
WHERE INSTR(post_content, '</em>') > 0;
Before you do that you may want to check to see how many rows this will affect:
SELECT COUNT(*)
FROM wp_posts
WHERE INSTR(post_content, '</em>') > 0;
You'll probably want to add a WHERE
clause to only identify those posts that actually contain an </em>
tag (and you may need to define the requirements for what to do in those cases).
No you can't.
SSH is an operating system for remote administration, what is happening when you do ssh and directly enter to the database is because of a script or default shell changed in /etc/passwd for the specific user.
But for mariadb(mysql) (including workbench) this means nothing, cause in practice is very likely to do ssh root@yourserver and then mysql -pyourpass.
So ssh is not the protocol you are looking for.
Best Answer
Not really.
Instead, you could do something like
to generate the desired 50+
UPDATE
statements. Then copy and paste them into the mysql commandline tool.(Or you could construct a shell script using that. Or...)