繁体   English   中英

mysqldump 无法备份数据库

[英]mysqldump cannot backup database

我正在尝试使用以下命令行备份一个小型数据库(15.7 KiB)并一直挂起,请记住,没有任何东西在后台运行,也没有 PHP 查询:

mysql -u root -pPASSWORD compet > /home/user/www/compet.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

运行进程列表:

mysql> show processlist;
+----+-----------------+-----------+--------+---------+------+------------------------+------------------+
| Id | User            | Host      | db     | Command | Time | State                  | Info             |
+----+-----------------+-----------+--------+---------+------+------------------------+------------------+
|  5 | event_scheduler | localhost | NULL   | Daemon  |  269 | Waiting on empty queue | NULL             |
|  8 | root            | localhost | compet | Sleep   |  235 |                        | NULL             |
| 13 | root            | localhost | NULL   | Query   |    0 | init                   | show processlist |
+----+-----------------+-----------+--------+---------+------+------------------------+------------------+
3 rows in set (0.00 sec)

我多次重启MySQL,还是同样的问题。

系统日志:

Dec  3 21:22:39 nsXXXX systemd[1]: Stopping MySQL Community Server...
Dec  3 21:22:43 nsXXXX systemd[1]: mysql.service: Succeeded.
Dec  3 21:22:43 nsXXXX systemd[1]: Stopped MySQL Community Server.
Dec  3 21:22:43 nsXXXX systemd[1]: Starting MySQL Community Server...
Dec  3 21:22:44 nsXXXX systemd[1]: Started MySQL Community Server.

mysql 错误日志:

2020-12-03T21:22:41.993028Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 8  user: 'root'.
2020-12-03T21:22:41.993158Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 10  user: 'root'.
2020-12-03T21:22:43.252856Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22-0ubuntu0.20.10.2)  (Ubuntu).
2020-12-03T21:22:43.587092Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22-0ubuntu0.20.10.2) starting as process 18545
2020-12-03T21:22:43.595246Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-03T21:22:44.266413Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-03T21:22:44.405846Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2020-12-03T21:22:44.626198Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-03T21:22:44.626556Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-03T21:22:44.648645Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22-0ubuntu0.20.10.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu).

很久没有结果

对于做数据库备份使用mysqldump而不是mysql

mysqldump -u root -pPASSWORD compet > /home/user/www/compet.sql

要从备份中恢复数据,请使用mysql命令:

mysql -u root -pPASSWORD compet < /home/user/www/compet.sql

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM