是否可以在mysql中使用commant从另一个数据库创建副本而不使用sql文件
我试过这个命令
mysqldump -u username -p old_database | mysql -u username -p new_database
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
lakhendrakushwah@LAKHENDRAs-MacBook-Air ~ % sudo -s
Password:
root@LAKHENDRAs-MacBook-Air ~ # mysqldump -u root -p lakha | mysql -u root -p testDB
Enter password: Enter password:
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
root@LAKHENDRAs-MacBook-Air ~ # mysqldump -u root -p lakha | mysql -u root -p testDB
Enter password: Enter password:
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
madhu@cool
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
1条答案
按热度按时间jdgnovmf1#
这是可能的,但您必须在同一命令中提供密码。
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
:错误是由于命令本身未指定密码。试试看!
***注:**new_database如果不存在,则必须首先使用CREATE DATABASE创建。