2016-07-25 80 views
0

当我尝试通过命令行来连接到远程MySQL数据库这尽管警告正常工作:如何使用命令行中的密码运行MYSQL脚本?

/sdzf => mysql -h db3 -u auser -ppassword DB_6 -A 
Warning: Using a password on the command line interface can be insecure. 

但是,在运行一个脚本不起作用

/sdzf => mysql -h db3 -u auser -ppassword DB_6 -A< findrec.sql 
Warning: Using a password on the command line interface can be insecure. 
ERROR 1045 (28000) at line 1: Access denied for user 'auser'@'50.206.86.74'  
(using password: YES) 
+0

您忘记了-p和密码之间的空格。 – FMashiro

+0

如果您以用户身份登录并尝试手动执行脚本,它是否有效? – 1615903

回答

0

尽管包括我的登录发言在批处理模式下运行时,我仍需要在我的SQL脚本中首先指向数据库的数据库名称:

USE DB_6;

如果我首先使用相同的脚本“mysql -h db3 -u auser -ppassword DB_6 -A”登录,那么我不需要在SQL中指向数据库。