Section "RunDB"
GetTempFileName $R0
FileOpen $R1 $R0 "w"
FileWrite $R1 "CREATE DATABASE IF NOT EXISTS openim;$\r$\n"
FileClose $R1
; First round: create the database
execDos::exec /NOUNLOAD /TIMEOUT=10000 \
'"$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysql.exe" \
--user=root --password=$mysql_root_pass < "$R0" ""'
Pop $0 # return value
MessageBox MB_OK "Exit code $0"
; Second round: run the schema
execDos::exec /NOUNLOAD /TIMEOUT=10000 \
'"$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysql.exe" \
--user=root --password=passroot --database=openim < "e:\server\openim.sql" ""'
Pop $0 # return value
MessageBox MB_OK "Exit code $0"
SectionEnd
Now I can understand InstallOption. When I read your code, i have some confuse.
; First round: create the database
execDos::exec /NOUNLOAD /TIMEOUT=10000 \
'"$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysql.exe" \
--user=root --password=$mysql_root_pass < "$R0" ""'
It runs $R0 to create database on mysql.When I create database on mysql, we must pass 3 function
+ Run mysql.exe
+ Enter password
+ Type this command
"create database if not exists openim"
Firstly, your command run mysql.exe and I can not understand how to work.
Although I try your code,I does not work. I aslo change many times but I do not work.
eg:
execDos::exec /NOUNLOAD /TIMEOUT=10000 \
'"$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysql.exe" --password=$mysql_root_pass < "$R0" ""'
If someone use to see this problem, please tell me!!!
Thank you very much for your help,