简体   繁体   中英

mysqldbcopy - Error 1045: Access denied for user 'root'@'localhost' (using password: NO)

i am using mysql workbench which has the command mysqldbcopy under linux. when i am trying to use it, i have to supply a connection string (see the examples here ).

my password contains ampersand (&), thus i am invoking mysqldbcopy as follows (for character escaping propose)

mysqldbcopy \
    --source "root:&1qqq34rtyy@localhost:3310:/var/run/mysqld/mysqld.sock" \
    --destination "root:&1qqq34rtyy@localhost:3310:/var/run/mysqld/mysqld.sock" \
    old:new

but i receive the following error, which by googling, i found that it means that i do not supply the right password (correct me if i am wrong)

# Source on localhost: ... ERROR: Cannot connect to the Source server.
Error 1045: Access denied for user 'root'@'localhost' (using password: NO)

could one please shed the light of where is the problem?

and yes, i am sure that the password is correct, it has been copied from .my.cnf , and i am able to use it under mysql command

mysqldbcopy

--source=root':&1qqq34rtyy'@localhost:3310:/var/run/mysqld/mysqld.sock  
--destination=root':&1qqq34rtyy'@localhost:3310:/var/run/mysqld/mysqld.sock 
 old:new  --force

I have also faced same issue,

The above mentioned syntax executes smoothly without any error. Use --force , if the destination database name already exists & needs to overwrite forcefully.

By looking at the link you provided, I can conclude this -

You are using -

mysqldbcopy \
    --source "root:&1qqq34rtyy@localhost:3310:/var/run/mysqld/mysqld.sock" \
    --destination "root:&1qqq34rtyy@localhost:3310:/var/run/mysqld/mysqld.sock" \
    old:new

But the link shows,

mysqldbcopy \   
    --source=root:pass@localhost:3310:/test123/mysql.sock \ 
    --destination=root:pass@localhost:3310:/test123/mysql.sock \   
   util_test:util_test_copy

Conclusions,

  1. After --source and --destination , the example in the link you provided have '=' .

  2. Try with single quotes if double quotes doesn't help.

  3. Verify if the port 3310 is correct. Default I guess when you install is 3306. Can you confirm?

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