import_win.bat 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. :: https://www.looklinux.com/mysql-warning-using-a-password-on-the-command-line-interface-can-be-insecure/#google_vignette ::
  2. :: MySQL 8.1.0 ::
  3. :: 需要终端输入一次密码 (如果在命令行直接出现密码-p,会报警告) ::
  4. :: Enter Password: (******) ::
  5. :: WARNING : 'local' path already exists and will be overwritten. ::
  6. :: Continue? (Press y|Y for Yes, any other key for No) : (y) ::
  7. :: Win10 (Company) ::
  8. set mysql="C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe"
  9. :: Win11 (Home) ::
  10. :: set mysql="D:\Program\MySQL\MySQL Server 8.1\bin\mysql.exe" ::
  11. set sql_directory="D:\CodeJava\QuickLaunchSpring\BackendSys\db"
  12. set port=3306
  13. set database_name=backendsys
  14. mysql_config_editor set --login-path=local --host=localhost --user=root --password
  15. @echo off
  16. echo begin .....
  17. for %%i in (%sql_directory%\*.sql) do (
  18. echo doing %%i wait ....
  19. echo set names utf8;>all.sql
  20. echo source %%i>>all.sql
  21. %mysql% --login-path=local -P%port% -D %database_name% --max_allowed_packet=1048576 --net_buffer_length=16384 < all.sql
  22. echo %%i end
  23. )
  24. echo all end ....
  25. del all.sql
  26. pause