Attempting to import data to Mysql using mysqlimport

Running MySql version 5.6.17 on a ML350 G5 server.  The operating system is Small Business Server 2008

Please understand I am learning Mysql .  I am not an expert.

I am trying to import a text file using mysqlimport utility.  

The command is below:
mysqlimport --user=root –password=dbxxx --fields-terminated-by=”,”   --lines-terminated-by=”\n” pivot D:\Invest-Import-Data\tblpivottxt.txt

The problem:
When I put the above command into a batch file mysql displays the error:
    “Error 1045 Access denied for user 'root @ localhost' (using password NO)

So I created a batch file which would change directory to the path where mysql exists .  The path is:
  c:\program files\Mysql\Mysql server 5.6\bin
Then I manually typed the mysqlimport command above and the data successfully  imported

Q1.)  I have attached the batch file and the txt file and the table structure.  What changes would you make to this batch file so I don't have to manually type the mysqlimport command?

Q2.)  What must I do so the password does not have to be entered as part of the mysqlimport command?

Please give detailed answers.  I am not a mysql expert.
Useful links are always appreciated.

Thank you for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Uma SuryaCommented:
Perhaps you do not have root access to the directory where you are saving?
Dave BaldwinFixer of ProblemsCommented:
To use that command format, you must have two '--' in front of password, not just one.  A single '-' is for a different format.

mysqlimport --user=root --password=dbxxx --fields-terminated-by=”,”   --lines-terminated-by=”\n” pivot D:\Invest-Import-Data\tblpivottxt.txt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
donpickAuthor Commented:
Hello Uma Surya:  I run the batch file in a command prompt.  When I invoke the command prompt, I explicitly invoke Administrator privileges so I feel there is no Windows permission problem.

Hello Dave Baldwin:
  Thank you for your help.  It always pays to have 2 sets of eyes to solve a problem.  You are correct, I needed 2 dashes in front of the password command.  I retyped the batch file, some how there were strange characters in the batch file itself.  Now it works.

So how about question 2, : How do I eliminate the need to have the password in the batch file?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Dave BaldwinFixer of ProblemsCommented:
If it is not there, the process will stop and ask you for it before continuing.  One way or another, you have to supply the password.
donpickAuthor Commented:
Thank you for your help.  I appreciate your prompt answers.
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.