Using MySQL often requires a free-to-install version (green version) of MySQL, began to search the Internet a lot, but it is not very useful.
Had to figure out their own, and now put out and share with you:
Install Startup services
[CPP]View PlainCopy
- @ECHO OFF
- If exist "%cd%/my.ini" goto startsrv
- for/f%%i in (' net start ') do if%%i==mysql goto mysql_isrunning
- Goto mysql_notrunning
- : mysql_isrunning
- echo "Found server!"
- net stop MySQL
- "%cd%"/bin/mysqld.exe-remove
- Goto Createmyini
- : mysql_notrunning
- echo "Not found!"
- : Createmyini
- REM-------------------------------------------------------
- REM Edit My.ini
- Setlocal enabledelayedexpansion
- Set realpath=
- Set replaced=/
- Set all=/
- for/f "delims="%%i in (' CD ') does (
- Set str=%%i
- Set "str=!str:%replaced%=%all%!"
- Set realpath=!str!
- )
- echo [Client] >>my.ini
- echo Default-character-set=utf8 >>my.ini
- Echo port=3306 >>my.ini
- echo [Server] >>my.ini
- echo Default-character-set=utf8 >>my.ini
- Echo port=3306 >>my.ini
- echo [MySQL] >>my.ini
- echo Default-character-set=utf8 >>my.ini
- echo [Mysqld] >>my.ini
- Echo port=3306 >>my.ini
- REM The following two sentences can be modified according to the actual situation
- Echo Basedir=%realpath%/>>my.ini
- Echo Datadir=%realpath%/data/>>my.ini
- echo Default-character-set=utf8 >>my.ini
- echo Default-storage-engine=innodb >>my.ini
- Echo max_connections=100 >>my.ini
- Echo query_cache_size=8m >>my.ini
- Echo table_cache=256 >>my.ini
- Echo tmp_table_size=9m >>my.ini
- Echo myisam_max_sort_file_size=100g >>my.ini
- Echo myisam_max_extra_sort_file_size=100g >>my.ini
- Echo myisam_sort_buffer_size=18m >>my.ini
- Echo key_buffer_size=11m >>my.ini
- Echo read_buffer_size=64k >>my.ini
- Echo read_rnd_buffer_size=256k >>my.ini
- Echo sort_buffer_size=256k >>my.ini
- Echo innodb_additional_mem_pool_size=2m >>my.ini
- Echo Innodb_flush_log_at_trx_commit=1 >>my.ini
- Echo innodb_log_buffer_size=1m >>my.ini
- Echo innodb_buffer_pool_size=18m >>my.ini
- Echo innodb_log_file_size=5m >>my.ini
- Echo innodb_thread_concurrency=8 >>my.ini
- REM Edit My.ini end.
- REM---------------------------------------------------------------
- "%cd%"/bin/mysqld.exe-install
- : startsrv
- net start MySQL
- Pause
- @ECHO on
Turn off Uninstall service
[CPP]View PlainCopy
- @ECHO off
- Set current_dir=%cd%
- Set mysql_home=%current_dir%
- net stop MySQL
- Bin/mysqld.exe-remove
- Del "%cd%"/my.ini
The key parts of the script are annotated, and if you have questions, you are welcome to discuss them together.
Also attach your own ready-to-install package (version 5.1.47), any version of the script is applicable
MySQL installation package (CSDN can not transfer large attachments, have to use this U egg, please carefully download)
If you already have the main file section, you can also put the bat file directly into the MySQL master directory
MySQL script. bat
http://blog.csdn.net/blpluto/article/details/5677457
MySQL Free install version script