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

时间:2020-05-31 06:56:43

标签: mysql mariadb

我正在将nextcloud服务器从运行raspian的raspberry pi 3迁移到运行raspian的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

基于Google搜索,我试图在/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

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

Raspberry Pi 4具有4 GB的内存,以备不时之需

1 个答案:

答案 0 :(得分:0)

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