mysqldump Error 1045 Access denied despite correct passwords etc

后端 未结 28 1671
执笔经年
执笔经年 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:23

    If you want to create a mysql data dump, you can use mysqldump command. Following command will create a sql file called xxx.sql at the same location from where this command is run. xxx.sql will have all the necessary sqls to replicate exactly same db schema in any other mysql database.

    Command is : mysqldump -u root -ppassword --databases database Name you want to import > xxx.sql

    Here root is the mysql root user and password is THIS root user's password.

    EXAMPLE: If root user password is hello, database name to export is regdb and xxx.sql is the file where you want to export this regdb, command would be like:

    mysqldump -u root -phello --databases regdb > xxx.sql

    Note: xxx.sql is the file name where this db will get dumped.

提交回复
热议问题