在 Windows 10 中从 XAMPP 中备份的 "data" 文件夹中恢复 InnoDB 数据库
Recovering InnoDB database from backed up "data" folder in XAMP in Windows 10
我从 mysql 文件夹复制了 data 目录并卸载了 XAMPP 因为 MySQL 没有启动。我安装了 XAMPP 相同版本并将 data 文件夹备份到 mysql 数据目录。起初只复制了 production 所需的数据库文件夹到 mysql 数据目录中。 PhpMyAdmin 正确显示了表格,尽管那里没有 record/row,并且显示“引擎中不存在 Table”。然后我将DATA文件夹中的所有内容复制到mysql数据文件夹,现在它不启动了。 现在的问题是 MySQL 没有启动 。我尝试设置
innodb_force_recovery 但未能启动 mysql.
错误日志如下:
2021-06-11 0:08:23 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-06-11 0:08:23 0 [Note] InnoDB: Uses event mutexes
2021-06-11 0:08:23 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-06-11 0:08:23 0 [Note] InnoDB: Number of pools: 1
2021-06-11 0:08:23 0 [Note] InnoDB: Using SSE2 crc32 instructions
2021-06-11 0:08:23 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2021-06-11 0:08:23 0 [Note] InnoDB: Completed initialization of buffer pool
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\applied.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`applied
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.applied
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\data.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`data
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.data
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\data_employer.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`data_employer
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.data_employer
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\education.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`education
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.education
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\education_list.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`education_list
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.education_list
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\industry.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`industry
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.industry
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\jobs.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`jobs
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.jobs
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`login
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.login
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login_admini.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`login_admini
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.login_admini
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login_employer.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`login_employer
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.login_employer
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\resume.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`resume
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.resume
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\selected.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for jobs`.`selected
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for jobs
.selected
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\entries.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for projects`.`entries
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for projects
.entries
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\geoname.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for projects`.`geoname
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for projects
.geoname
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\geonamebackup.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for projects`.`geonamebackup
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for projects
.geonamebackup
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\pincodes.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for projects`.`pincodes
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for projects
.pincodes
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\specifier.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for projects`.`specifier
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for projects
.specifier
because it could not be opened.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\users.ibd' OS error: 203
2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for projects`.`users
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace for projects
.users
because it could not be opened.
2021-06-11 0:08:23 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-06-11 0:08:23 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-06-11 0:08:23 0 [Note] InnoDB: Setting file 'D:\Program Files\XAMP\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-06-11 0:08:23 0 [Note] InnoDB: File 'D:\Program Files\XAMP\mysql\data\ibtmp1' size is now 12 MB.
2021-06-11 0:08:23 0 [Note] InnoDB: Waiting for purge to start
2021-06-11 0:08:23 0 [Note] InnoDB: 10.4.19 started; log sequence number 1515509790; transaction id 611499
2021-06-11 0:08:23 0 [Note] InnoDB: Loading buffer pool(s) from D:\Program Files\XAMP\mysql\data\ib_buffer_pool
2021-06-11 0:08:23 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-06-11 0:08:23 0 [Note] Server socket created on IP: '::'.
能够取回数据。
第 1 步:将 mysql/data 目录中的所有文件移动到 data_old 目录,mysql 和 performance_schema 目录除外。
第 2 步:从备份目录中复制回 ibdata1 文件,同时复制回包含要恢复的数据库名称的文件夹。
第 3 步:现在开始mysql,您将能够看到数据库。使用 mysqldump 导出到 sql 文件。
步骤 4:卸载 mysql / xampp。重新安装 xampp.
第 5 步:使用备份数据库的名称创建一个数据库。并使用 mysqldump 恢复数据。
另外请记住,删除数据库后 phpMyAdmin 可能无法工作,因此您可能需要切换到控制台。
就我而言,此解决方案有效:
如果id*文件被删除,没有snapshot/backup,那么需要重新初始化mysql,
在任何更改之前拍摄快照
如果已经mysql转储所有数据库,跳转到第 2 步
mkdir /tmp/mysql
vi /etc/my.cnf(删除以下变量如果存在:innodb_file_per_table、innodb_force_recovery)
mysqld --console --user=mysql --initialize --datadir=/tmp/mysql
cp -p /tmp/mysql/ib* /var/lib/mysql
vi /etc/my.cnf
添加一行:innodb_force_recovery=6
systemctl start mysql
mysqldump --all-databases > alldb.sql
初始化mysql
rm -Rf /var/lib/mysql/*
vi /etc/my.cnf(如果存在则删除变量:innodb_file_per_table、innodb_force_recovery)
mysqld --console --user=mysql --initialize --datadir=/var/lib/mysql
(输出将显示临时密码,例如,“为 root@localhost 生成临时密码:MWq.j0>RMdV>”)
systemctl 启动mysql
mysql -u root -p
(使用临时密码登录,并为 root 设置密码——将“7layer”替换为您当前在 ~/ 中的默认密码。my.cnf)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '7layer';
mysql> exit;
恢复数据
mysql < alldb.sql
(根据需要替换 sql 文件名)
恢复用户权限
mysql> 刷新权限;
我从 mysql 文件夹复制了 data 目录并卸载了 XAMPP 因为 MySQL 没有启动。我安装了 XAMPP 相同版本并将 data 文件夹备份到 mysql 数据目录。起初只复制了 production 所需的数据库文件夹到 mysql 数据目录中。 PhpMyAdmin 正确显示了表格,尽管那里没有 record/row,并且显示“引擎中不存在 Table”。然后我将DATA文件夹中的所有内容复制到mysql数据文件夹,现在它不启动了。 现在的问题是 MySQL 没有启动 。我尝试设置 innodb_force_recovery 但未能启动 mysql.
错误日志如下:
2021-06-11 0:08:23 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2021-06-11 0:08:23 0 [Note] InnoDB: Uses event mutexes 2021-06-11 0:08:23 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2021-06-11 0:08:23 0 [Note] InnoDB: Number of pools: 1 2021-06-11 0:08:23 0 [Note] InnoDB: Using SSE2 crc32 instructions 2021-06-11 0:08:23 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M 2021-06-11 0:08:23 0 [Note] InnoDB: Completed initialization of buffer pool 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\applied.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for
jobs`.`applied
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.applied
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\data.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`data
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.data
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\data_employer.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`data_employer
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.data_employer
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\education.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`education
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.education
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\education_list.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`education_list
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.education_list
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\industry.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`industry
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.industry
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\jobs.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`jobs
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.jobs
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`login
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.login
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login_admini.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`login_admini
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.login_admini
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login_employer.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`login_employer
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.login_employer
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\resume.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`resume
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.resume
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\selected.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forjobs`.`selected
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forjobs
.selected
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\entries.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forprojects`.`entries
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forprojects
.entries
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\geoname.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forprojects`.`geoname
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forprojects
.geoname
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\geonamebackup.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forprojects`.`geonamebackup
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forprojects
.geonamebackup
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\pincodes.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forprojects`.`pincodes
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forprojects
.pincodes
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\specifier.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forprojects`.`specifier
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forprojects
.specifier
because it could not be opened. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation. 2021-06-11 0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified. 2021-06-11 0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them. 2021-06-11 0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\users.ibd' OS error: 203 2021-06-11 0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation. 2021-06-11 0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/ 2021-06-11 0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file forprojects`.`users
. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue. 2021-06-11 0:08:23 0 [Warning] InnoDB: Ignoring tablespace forprojects
.users
because it could not be opened. 2021-06-11 0:08:23 0 [Note] InnoDB: 128 out of 128 rollback segments are active. 2021-06-11 0:08:23 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2021-06-11 0:08:23 0 [Note] InnoDB: Setting file 'D:\Program Files\XAMP\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2021-06-11 0:08:23 0 [Note] InnoDB: File 'D:\Program Files\XAMP\mysql\data\ibtmp1' size is now 12 MB. 2021-06-11 0:08:23 0 [Note] InnoDB: Waiting for purge to start 2021-06-11 0:08:23 0 [Note] InnoDB: 10.4.19 started; log sequence number 1515509790; transaction id 611499 2021-06-11 0:08:23 0 [Note] InnoDB: Loading buffer pool(s) from D:\Program Files\XAMP\mysql\data\ib_buffer_pool 2021-06-11 0:08:23 0 [Note] Plugin 'FEEDBACK' is disabled. 2021-06-11 0:08:23 0 [Note] Server socket created on IP: '::'.
能够取回数据。
第 1 步:将 mysql/data 目录中的所有文件移动到 data_old 目录,mysql 和 performance_schema 目录除外。
第 2 步:从备份目录中复制回 ibdata1 文件,同时复制回包含要恢复的数据库名称的文件夹。
第 3 步:现在开始mysql,您将能够看到数据库。使用 mysqldump 导出到 sql 文件。
步骤 4:卸载 mysql / xampp。重新安装 xampp.
第 5 步:使用备份数据库的名称创建一个数据库。并使用 mysqldump 恢复数据。
另外请记住,删除数据库后 phpMyAdmin 可能无法工作,因此您可能需要切换到控制台。
就我而言,此解决方案有效:
如果id*文件被删除,没有snapshot/backup,那么需要重新初始化mysql,
在任何更改之前拍摄快照
如果已经mysql转储所有数据库,跳转到第 2 步
mkdir /tmp/mysql
vi /etc/my.cnf(删除以下变量如果存在:innodb_file_per_table、innodb_force_recovery)
mysqld --console --user=mysql --initialize --datadir=/tmp/mysql
cp -p /tmp/mysql/ib* /var/lib/mysql
vi /etc/my.cnf
添加一行:innodb_force_recovery=6
systemctl start mysql
mysqldump --all-databases > alldb.sql
初始化mysql
rm -Rf /var/lib/mysql/*
vi /etc/my.cnf(如果存在则删除变量:innodb_file_per_table、innodb_force_recovery)
mysqld --console --user=mysql --initialize --datadir=/var/lib/mysql
(输出将显示临时密码,例如,“为 root@localhost 生成临时密码:MWq.j0>RMdV>”)
systemctl 启动mysql
mysql -u root -p
(使用临时密码登录,并为 root 设置密码——将“7layer”替换为您当前在 ~/ 中的默认密码。my.cnf)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '7layer';
mysql> exit;
恢复数据
mysql < alldb.sql
(根据需要替换 sql 文件名)
恢复用户权限
mysql> 刷新权限;