Can I login in my MySQL account? I want to change my password, create a database and import a database.
CAn somebody give me a sample how I can do that?
Tulp
MySQL login
17 posts
You can use mysql with command line parameters to execute sql commands. That way you should be able to create database and import from a file.
I don´t remember the actual syntax so have a look at the mysql documentation.
I don´t remember the actual syntax so have a look at the mysql documentation.
someone know how I can do that exactly?
OK, I found out the command to use,l but NSIS gives an error.
ExecWait '$INSTDIR\MySQL\bin>mysql --user=root -e "set password = password('Mira 0101')"'
The problem is in the quotes?
ExecWait '$INSTDIR\MySQL\bin>mysql --user=root -e "set password = password('Mira 0101')"'
The problem is in the quotes?
I think it should look like this:
ExecWait `$INSTDIR\MySQL\bin\mysql --user=root -e "set password = password('Mira 0101')"`
You have to use different quotes, NSIS supports " ' and `.
Also, after bin there has to be a backslash not a ">"
Nevertheless, it would be better, if you posted the error.
ExecWait `$INSTDIR\MySQL\bin\mysql --user=root -e "set password = password('Mira 0101')"`
You have to use different quotes, NSIS supports " ' and `.
Also, after bin there has to be a backslash not a ">"
Nevertheless, it would be better, if you posted the error.
Thank you for the reply Larsen.
The command works now but it still don't change the password. I can go in the mysql by typing ENTER.
So no password need, but I want that the user enter a password. Where is the problem?
The command works now but it still don't change the password. I can go in the mysql by typing ENTER.
So no password need, but I want that the user enter a password. Where is the problem?
Sorry for the late reaction!
Thanx for the link Instructor.
I tryed this command but still no result, it doesn't give any error message, but it skip the command:
ExecCmd::exec `$INSTDIR\MySQL\bin\mysql --user=root --password= -e "set password = password('Mira 0101')"`
Any help?
Thanx for the link Instructor.
I tryed this command but still no result, it doesn't give any error message, but it skip the command:
ExecCmd::exec `$INSTDIR\MySQL\bin\mysql --user=root --password= -e "set password = password('Mira 0101')"`
Any help?
ExecCmd::exec `"$INSTDIR\MySQL\bin\mysql" --user=root --password= -e "set password = password('Mira 0101')"`
Pop $0
MessageBox MB_OK "Exit code $0"Thanks for tye reply Instructor.
I tryed your code, but it doesn't work.
It still skip the command!
If I use the command in cmd mode, it works properly, only in NSIS it doen's work.
I tryed your code, but it doesn't work.
It still skip the command!
If I use the command in cmd mode, it works properly, only in NSIS it doen's work.
You must do it like this:
ReadEnvStr $0 COMSPEC
ExecWait '$0 /C "$INSTDIR\MySQL\bin\mysql" --user=root --password= -e "set password = password('Mira 0101')"' $R9
for example... you need the context of the console!!!
ReadEnvStr $0 COMSPEC
ExecWait '$0 /C "$INSTDIR\MySQL\bin\mysql" --user=root --password= -e "set password = password('Mira 0101')"' $R9
for example... you need the context of the console!!!
Thanks for the reply Hugi,
It still skip the command.
There's an error in ur command hugi, after ExecWait u use: '', U have to use the `` parameters.
But it still doesn't work.
Any help?
It still skip the command.
There's an error in ur command hugi, after ExecWait u use: '', U have to use the `` parameters.
But it still doesn't work.
Any help?
I am not sure, but most of Windows executables have exe extension and I see right now "MySQL\MySQL Server 4.1\mysql.exe" file 🙂 This is not required in DOS window, but is mandatory for system calls. And I could print --help to file
ExecCmd::exec /TEST /TIMEOUT=10000 \
'"$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysql.exe" --help >stdout.txt'
Pop $0
MessageBox MB_OK "Exit code $0"
There probably need empty string for correct stack output:
ExecCmd::exec /TEST /TIMEOUT=10000 \
'"$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysql.exe" --help >stdout.txt' ""
Pop $0
MessageBox MB_OK "Exit code $0"
Yes, if stack is not empty 🙂
@Takhir and @Instructor,
Where can I implement my code with yours?
Where can I implement my code with yours?
Tested 🙂
nsExec::Exec `"d:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe" --user=root --password="old password" -e "SET PASSWORD = PASSWORD('new password')"`
Pop $0
MessageBox MB_OK '$$0={$0}'