pillmill
asked on
windows batch set null?
I want to execute a mysqldump command with the password set to a null value
using the attached code.
It will run interactively, putting in a carriage return for the password,
but I can't get the batch file to work.
How can I fix this?
using the attached code.
It will run interactively, putting in a carriage return for the password,
but I can't get the batch file to work.
How can I fix this?
@ECHO OFF
CLS
ECHO.
set pass=
C:\wamp\bin\mysql\mysql5.1.36\bin\mysqldump -u user -p %pass% test > dump.sql
ECHO.
ECHO Finished.
Omit the -p parameter entirely and it should connect to the database without a password (provided the user account is setup that way in mysql)
ASKER
Thanks. If the -p parameter is omitted, the following error occurs:
"Using password: NO, Access denied"
It will execute correctly when run interactively, with a carriage return for password.
"Using password: NO, Access denied"
It will execute correctly when run interactively, with a carriage return for password.
What happens if you use -p ""? (two double quotes would be an empty string, right?)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
"The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, mysqldump prompts for one."
"The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, mysqldump prompts for one."
Not familiar with this sql command it but if it waits for a password from a command prompt as opposed to a pop up window then you could try piping one into the program:
echo.|c:\wamp\bin\mysql\my sql5.1.36\ bin\mysqld ump -u user -p test > dump.sql
(or whatever you need to do for the password prompt to appear)
Steve
echo.|c:\wamp\bin\mysql\my
(or whatever you need to do for the password prompt to appear)
Steve
You can remove the password from the server
mysqladmin -u root -p password ”
Once executed you should be able to connect using that username and no password.
I'll leave out the security chat...
mysqladmin -u root -p password ”
Once executed you should be able to connect using that username and no password.
I'll leave out the security chat...
ASKER
Thanks