错误 2013 (HY000) 尝试导入 mariadb 数据库



我正在将下一个云服务器从运行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 服务时会选择新设置,我当然在重新启动之前尝试这样做。

相关内容

  • 没有找到相关文章

最新更新