mysqldump Error 1045 Access denied despite correct passwords etc

后端 未结 28 1162
执笔经年
执笔经年 2021-01-30 12:56

This is a tricky one, I have the following output:

mysqldump: Got error: 1045: Access denied for user \'root\'@\'localhost\' (using password: YES) when tr

相关标签:
28条回答
  • 2021-01-30 13:01

    If you're able to connect to the database using mysql, but you get an error for mysqldump, then the problem may be that you lack privileges to lock the table.

    Try the --single-transaction option in that case.

    mysqldump -h database.example.com -u mydbuser -p mydatabase --single-transaction  > /home/mylinuxuser/mydatabase.sql
    
    0 讨论(0)
  • 2021-01-30 13:03

    mysqldump -h hostname -u username -P port -B database --no-create-info -p > output.sql

    I think you should specify the args

    0 讨论(0)
  • 2021-01-30 13:03

    I had to remove the single ticks after the password flag:

    --password=mypassword
    

    and NOT

    --password='mypassword'
    
    0 讨论(0)
  • 2021-01-30 13:04

    The access being denied is probably to the Windows file system not to the MySQL database; try redirecting the output file to a location where your account is allowed to create files.

    0 讨论(0)
  • 2021-01-30 13:04

    mysqldump -u (user) -p(passwd) -h (host_or_IP) database_to_backup > backup_file.sql

    example:

    mysqldump -u god -pheaven -h 10.0.10.10 accounting > accounting_20141209.sql

    this would create sql backup file for the accounting database on server 10.0.10.10. Sometimes your error is seen when localhost is not in config. Designating ip of server may help.

    0 讨论(0)
  • 2021-01-30 13:05

    Try to remove the space when using the -p-option. This works for my OSX and Linux mysqldump:

    mysqldump -u user -ppassword ...
    
    0 讨论(0)
提交回复
热议问题