mysql替换表的字段里面内容,如例子:

引用

mysql> select host,user from user  where user='user';
+-----------------------+----------+
| host                  | user     |
+-----------------------+----------+
| localhost.localdomain | testuser |
+-----------------------+----------+

update字段host的内容,把"main"改成"slave",用REPLACE

mysql> update user set host=REPLACE(host,'main','slave') where user='user';      
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select host,user from user  where user='user';                            
+------------------------+----------+
| host                   | user     |
+------------------------+----------+
| localhost.localdoslave | testuser |
+------------------------+----------+

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-06-12
  • 2022-02-10
  • 2022-12-23
  • 2021-06-20
猜你喜欢
  • 2022-02-07
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案