简体   繁体   中英

restore database from dump via console

I am trying to restore database from db.sql dump I have installed mysql (both client and server), when I have installed server I defined password for root user and I am trying to restore DB with such command

nnn@nnn:~/prj/myprj$mysql -user=root -password=qwerty <db.sql

But I get the following error ERROR 1045 (28000): Access denied for user 'ser=root'@'localhost' (using password: YES) I have just create this password so it could not be wrong. Perhaps something else wrong in syntax? (I am using ubuntu by the way)

You need double dashes in front of long option names like --user , with singe dash it is taken as short option -u and the rest is taken as user name ser=root

So it is either

mysql --user=root --password=qwerty db_name < db.sql

or with short options

mysql -uroot -pqwerty db_name < db.sql

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