Avatar of donpick
donpick

asked on 

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

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
MySQL ServerDatabases

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon