0

I'm trying to run check mysql and repair mysql functions in a sql file from another batch file.

I get the error as:

C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe"  "mysql -u root -p < batch.sql"
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

Batch File (run.bat):

"C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe"  "mysql -u root -p < batch.sql"
pause

SQL File (batch.sql):

CHECK TABLE logs;
REPAIR TABLE logs;
Leo Gallego
  • 1,893
  • 9
  • 17
Anu
  • 1
  • I just edited your question's format to set the code blocks, you should use them to make code clear. Also, your question is not clear. What are you trying to accomplish? Are you importing an SQL dump into another clean database and trying to run a check/repair after? – Leo Gallego Jul 14 '18 at 03:28
  • I am not trying to import. Just run a batch file which will have check and repair tables for wampserver installed locally. – Anu Jul 16 '18 at 18:27

1 Answers1

0

If you read the error, you will see it is reporting that the user (ODBC) doesn't have permission to do what you are asking.

C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe"  "mysql -u root -p < batch.sql"
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

Also, that command seems to be wrong. I'm not a Windows user, but it seems you are trying to import the query into nothing. You should run something along the lines of:

C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe -u{username} -p{databasename} < file_name.sql

Where {username} is the user with access (you are using root apparently) and {database}} is the database that you want to check/repair, without the spaces after the -u and -p.

Alexander Tolkachev
  • 4,608
  • 3
  • 14
  • 23
Leo Gallego
  • 1,893
  • 9
  • 17
  • "C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe" "mysql -u root -p groundspace < batch.sql" ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) Still the same error – Anu Jul 16 '18 at 18:09