难点主要在参数的传递方式吧,不过查资料后发现很简单。
1.使用-e参数传递命令,适用于简单语句
     mysql -uuser -ppasswd -e "create database dbtest;"
2.使用EOF传递复杂语句
     mysql -uuser -ppasswd <<EOF
     create database dbtest;
     use dbtest;
     create table test(field1 int UNIQUE, field2 int);
     insert into test(field1) values(1);
     EOF
勉强够用了吧。

相关文章:

  • 2021-12-27
  • 2022-01-20
  • 2022-01-18
  • 2021-07-14
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2021-08-24
  • 2022-12-23
  • 2021-12-21
  • 2022-01-02
  • 2022-01-11
相关资源
相似解决方案