We help IT Professionals succeed at work.
Get Started

Attempting to import data to Mysql using mysqlimport

donpick
donpick asked
on
177 Views
Last Modified: 2015-12-08
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

Questions:
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.
tblpivottxt.txt
Mysql-Import.txt
tblpivottxt-structure.png
Comment
Watch Question
Fixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
This problem has been solved!
Unlock 2 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE