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