How to use mysql to remove the hyperlink and remain with the text?

If you have a lot of articles, and there some hyperlinks here and there, it will be very difficult for us to remove them one by one. For example, you have about 10,000 articles, if you check each articles, I am sure you will have to cost several days to remove the hyperlinks and keek the text.

There are 2 method to do this, one is using php code, we can read the article from mysql database, and using php to replace; another method, we can control mysql directly. For example, as we know, there are many people using dede cms to build sites, and all the articles is stored under body of dede_addonarticle.

Here, let share the second method with you, log in your mysql database via phpmyadmin, and choose your database, run the following sql:

update dede_addonarticle set body = replace(body,substring(body,locate(“<a “, body),locate(“>”, body,locate(“<a “, body))+1-locate(“<a “, body)),””);