方法1, 将表数据导出成文本,删除表数据,文本替换后重新导回去。
方法2,写脚本逐条纪录更新。

解决方案 »

  1.   

    mysql> use test;
    Database changed
    mysql> create table aa(id int not null auto_increment primary key,name varchar(2
    0));
    Query OK, 0 rows affected (0.13 sec)mysql> insert into aa values(1,'社会新闻'),(2,'国际新闻');
    Query OK, 2 rows affected (0.08 sec)
    Records: 2  Duplicates: 0  Warnings: 0mysql> select * from aa;
    +----+----------+
    | id | name     |
    +----+----------+
    |  1 | 社会新闻 |
    |  2 | 国际新闻 |
    +----+----------+
    2 rows in set (0.00 sec)mysql> update aa set name=replace(name,'新闻','时事');
    Query OK, 2 rows affected (0.03 sec)
    Rows matched: 2  Changed: 2  Warnings: 0mysql> select * from aa;
    +----+----------+
    | id | name     |
    +----+----------+
    |  1 | 社会时事 |
    |  2 | 国际时事 |
    +----+----------+
    2 rows in set (0.00 sec)