简体   繁体   中英

ERROR 1044 (42000): Access denied for user ''@'localhost'

I am working on a Perl script which uses mysqldiff to compare two databases and then apply changes to the first database. The command I am using:

mysqldiff --host=$dbHost --user=$dbUser -A $dbName1 $dbName2

I am getting the difference but after that there is the following error happens always:

ERROR 1044 (42000): Access denied for user ''@'localhost' to database <NAME OF THE DATABASE>

How can I solve this issue?

Do i asume right you get at least following message?:

nApply above changes to $db0 [y/N] ?

if yes it seems like the auth_args from MySQL::Diff doesn't work. You can try to use the alternative Statements:

GetOptions(\\%opts, "help|?", "debug|d:i", "apply|A", "batch-apply|B", "keep-old-tables|k", "keep-old-columns|c", "no-old-defs|n", "only-both|o", "table-re|t=s", "host|h=s", "port|P=s", "socket|s=s", "user|u=s", "password|p:s", "host1=s", "port1=s", "socket1=s", "user1=s", "password1:s", "host2=s", "port2=s", "socket2=s", "user2=s", "password2:s", "tolerant|i", "single-transaction|S", "list-tables|l" )

(see sourcecode)

If this doesn't work try to start it in debug mode with

-d, --debug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM