fanblogs
#!/bin/bash
# 假设将sakila数据库名改为new_sakila
# MyISAM直接更改数据库目录下的文件即可

mysql -uroot -p123456 -e \'create database if not exists new_sakila\'
list_table=$(mysql -uroot -p123456 -Nse "select table_name from information_schema.TABLES where TABLE_SCHEMA=\'sakila\'")

for table in $list_table
do
    mysql -uroot -p123456 -e "rename table sakila.$table to new_sakila.$table"
done

分类:

技术点:

相关文章:

  • 2022-01-01
  • 2021-11-19
  • 2021-11-19
  • 2022-02-09
  • 2021-11-01
  • 2021-08-01
  • 2022-02-08
  • 2021-11-19
猜你喜欢
  • 2021-11-21
  • 2021-12-24
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
  • 2021-12-29
  • 2022-01-13
相关资源
相似解决方案