【问题标题】:ERROR 2013 (HY000) trying to import mariadb database错误 2013 (HY000) 试图导入 mariadb 数据库
【发布时间】:2020-09-18 14:24:56
【问题描述】:

我正在将 nextcloud 服务器从运行 raspian Stretch 的 raspberry pi 3 迁移到运行 raspian buster 的 rpi 4。一个步骤是转储 mariadb 数据库并在新服务器上导入。我创建了 mariadb 数据库的转储(数据库转储文件为 120MB),并准备使用以下命令恢复它:

mysql -h localhost -u nextcloud -p<password> -e "CREATE DATABASE nextcloud"

mysql -h localhost -uroot -p<password> -e "GRANT ALL PRIVILEGES on nextcloud.* to nextcloud@localhost"

mysql -h localhost -u nextcloud -p<password> nextcloud < <backup_db_file>

但是,我收到以下错误:

ERROR 2013 (HY000) at line 746: Lost connection to MySQL server during query

基于谷歌搜索,我尝试修改 /etc/mysql/my.cnf 中的 mariadb 配置文件,如下所示:

# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

[mysqld]
max_allowed_packet = 160M
net_read_timeout = 300
net_write_timeout = 600
innodb_buffer_pool_size = 2G

[mysqldump]
max_allowed_packet = 160M

但我得到了同样的错误。谁能建议我可能做错了什么,或者我该如何解决这个问题?

树莓派 4 有 4 GB 的内存以防万一

【问题讨论】:

    标签: mysql mariadb


    【解决方案1】:

    所以,实际上,我重新启动了服务器,然后就可以导入数据库了。我认为当我重新启动 mysql 服务时会选择新的设置,我在重新启动之前肯定会尝试这样做。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-19
      • 2017-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-08
      • 2017-08-07
      • 2022-12-06
      相关资源
      最近更新 更多