在MYSQL中导入cookbook.sql文件
参考资料:
GitHub 项目:svetasmirnova/mysqlcookbook
CSDN 博客:https://blog.csdn.net/u011868279/category_11645577.html
建库:
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> CREATE DATABASE cookbook;
Query OK, 1 row affected (0.00 sec)mysql> show databases;
+--------------------+
| Database |
+--------------------+
| carrefour |
| cookbook |
| information_schema |
| menagerie |
| mysql |
| performance_schema |
| sys |
+--------------------+
7 rows in set (0.00 sec)mysql>
Guide:
[root@MaxwellDBA backup]# ls -ltt
total 16428
-rw-r--r-- 1 root root 16813610 Oct 13 14:18 cookbook.sql
-rw-r--r-- 1 root root 4794 Oct 13 11:03 carrefour_dump.sql
[root@MaxwellDBA backup]# pwd
/var/lib/mysql/backup
[root@MaxwellDBA backup]# mysql -u root -p cookbook < cookbook.sql
Enter password:
[root@MaxwellDBA backup]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 100
Server version: 8.0.26 Source distributionCopyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database |
+--------------------+
| carrefour |
| cookbook |
| information_schema |
| menagerie |
| mysql |
| performance_schema |
| sys |
+--------------------+
7 rows in set (0.00 sec)mysql> use cookbook
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql>
mysql> show tables;
+-----------------------+
| Tables_in_cookbook |
+-----------------------+
| actors |
| adcount |
| al_winner |
| app_log |
| artist |
| book_authors |
| book_vendor |
| booksales |
| catalog_list |
| cd |
| city |
| color |
| cow_color |
| cow_order |
| date_val |
| datetbl |
| datetime_val |
| die |
| doremi |
| drawing |
| driver_log |
| expt |
| formula1 |
| goods_characteristics |
| goods_shops |
| groceries |
| groceries_order_items |
| hitcount |
| hitlog |
| hostip |
| hostname |
| housewares |
| housewares2 |
| housewares3 |
| housewares4 |
| httpdlog |
| httpdlog2 |
| hw_category |
| image |
| ingredient |
| insect |
| inv_item |
| invoice |
| item |
| limbs |
| mail |
| marathon |
| mark_log |
| metal |
| money |
| movies |
| movies_actors |
| movies_actors_link |
| name |
| news |
| newsstaff |
| numbers |
| obs |
| occasion |
| painting |
| passtbl |
| passwd |
| patients |
| perl_session |
| person |
| php_session |
| phrase |
| player_stats |
| player_stats2 |
| poi |
| poll_vote |
| profile |
| profile_contact |
| rainfall |
| rand_names |
| rank |
| ranks |
| reviews |
| roster |
| ruby_session |
| sales_region |
| sales_tax_rate |
| sales_volume |
| sibling |
| standings1 |
| standings2 |
| states |
| str_val |
| sundays |
| testscore |
| testscore_withmisses |
| testscore_withmisses2 |
| time_val |
| tmp |
| tomcat_role |
| tomcat_session |
| tomcat_user |
| top_names |
| trip_leg |
| trip_log |
| tsdemo |
| weatherdata |
| weekday |
+-----------------------+
103 rows in set (0.00 sec)
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/u011868279/article/details/127301090
D:\software\MySql\bin>mysql -u root -p cookbook < D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql
Enter password: ****
ERROR 1050 (42S01) at line 1073: Table 'limbs' already existsD:\software\MySql\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 8.0.40 MySQL Community Server - GPLCopyright (c) 2000, 2024, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database |
+--------------------+
| cookbook |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)mysql> use cookbook
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_cookbook |
+-----------------------+
| actors |
| adcount |
| al_winner |
| app_log |
| artist |
| book_authors |
| book_vendor |
| booksales |
| catalog_list |
| cd |
| city |
| color |
| cow_color |
| cow_order |
| date_val |
| datetbl |
| datetime_val |
| die |
| doremi |
| drawing |
| driver_log |
| expt |
| formula1 |
| goods_characteristics |
| goods_shops |
| groceries |
| groceries_order_items |
| hitcount |
| hitlog |
| hostip |
| hostname |
| housewares |
| housewares2 |
| housewares3 |
| housewares4 |
| httpdlog |
| httpdlog2 |
| hw_category |
| image |
| ingredient |
| insect |
| inv_item |
| invoice |
| item |
| limbs |
| mail |
| mail_view |
| mytable |
| profile |
| profile_contact |
| some table |
| taxpayer |
+-----------------------+
52 rows in set (0.00 sec)
小迪,为什么 导入D:\software\MySql\bin>mysql -u root -p cookbook < D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql 只有52个文件,原程序有
103 rows in set (0.00 sec)
关于MySQL导入文件数量不一致的问题
您遇到的问题是:从cookbook.sql文件导入时只导入了52个表/数据,而原程序应该有103个。
可能的原因
SQL文件不完整:检查cookbook.sql文件是否完整,可能只包含了部分内容
字符编码问题:文件可能在传输或保存过程中使用了不兼容的字符编码,导致部分SQL语句无法正确解析
执行错误:导入过程中可能有部分语句执行失败,但未显示错误
文件路径问题:确认D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql确实是完整的文件
解决方案
检查文件完整性:
type D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql | find “CREATE TABLE”
统计文件中包含的CREATE TABLE语句数量
分步导入:
mysql -u root -p cookbook < D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql > import.log 2>&1
这样可以将导入过程的输出和错误保存到import.log文件中查看
使用MySQL客户端直接导入:mysql -u root -p
use cookbook;
source D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql;
这样可以实时看到执行过程中的任何错误
验证数据:
导入后执行:
SHOW TABLES;
SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = ‘cookbook’;
查看实际导入的表数量
如果您能提供导入过程中的错误信息或SQL文件的开头部分,我可以给出更具体的建议。
mysql> source D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql;
mysql Ver 8.0.40 for Win64 on x86_64 (MySQL Community Server - GPL)
Connection id: 19
Current database: cookbook
Current user: root@localhost
SSL: Cipher in use is TLS_AES_256_GCM_SHA384
Using delimiter: ;
Server version: 8.0.40 MySQL Community Server - GPL
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: gbk
Conn. characterset: gbk
TCP port: 3306
Binary data as: Hexadecimal
Uptime: 6 days 22 hours 53 min 31 sec
Threads: 2 Questions: 855 Slow queries: 0 Opens: 202 Flush tables: 3 Open tables: 120 Queries per second avg: 0.001
向小迪咨询,解决方案:
ERROR:
Unknown command ‘\M’.
ERROR:
Unknown command ‘\m’.
ERROR 1049 (42000): Unknown database ‘ecipescookbook.sql;’
从您提供的错误信息来看,导入过程中出现了几个关键问题:
问题分析
字符编码问题:
客户端字符集是GBK,而服务器使用utf8mb4
这可能导致SQL文件中的某些特殊字符被错误解析
路径解析错误:
错误显示 Unknown database ‘ecipescookbook.sql;’,表明MySQL尝试将您的SQL文件名的一部分当作数据库名
转义字符问题:
\M 和 \m 被当作MySQL命令,但实际可能是文件中的内容
解决方案
统一字符集:
sql
SET NAMES utf8mb4;
在导入前先执行这条命令,确保客户端、连接和结果使用一致的字符集
使用完整路径的正确格式:
Windows路径中的反斜杠需要转义或改为正斜杠:
sql
source D:/sql/MySQL_cookbook/mysqlcookbook-master/recipes/cookbook.sql
或
sql
source D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql
检查文件内容:
用文本编辑器打开SQL文件,检查开头部分是否有异常内容或特殊字符
尝试替代导入方法:
bash
mysql -u root -p cookbook --default-character-set=utf8mb4 < “D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql”
分块导入:
如果文件很大,可以尝试用文本编辑器分割成多个小文件分别导入
您能否提供SQL文件的开头几行内容?这样我可以更准确地判断问题所在。
-- Dump created by MySQL pump utility, version: 8.0.27, Linux (x86_64)
-- Dump start time: Mon Feb 14 02:25:01 2022
-- Server version: 8.0.27SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET @OLD_TIME_ZONE=@@TIME_ZONE;
SET TIME_ZONE='+00:00';
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8mb4;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `cookbook` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
根据您提供的SQL文件开头内容,这是一个由MySQL 8.0.27的pump工具创建的完整数据库转储文件。结合之前的错误信息,以下是解决方案:
问题根源
字符集冲突:
文件指定了utf8mb4但客户端使用gbk
导致特殊字符和转义序列被错误解析
Windows路径问题:
反斜杠被解释为转义字符
客户端版本差异:
转储文件来自8.0.27(Linux),您使用的是8.0.40(Windows)
完整解决方案
方法1:使用命令行导入(推荐)
cmd
mysql -u root -p --default-character-set=utf8mb4 cookbook < “D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql”
方法2:在MySQL客户端中正确导入
先连接到MySQL:cmd
mysql -u root -p --default-character-set=utf8mb4
然后执行:sql
SET NAMES utf8mb4;
USE cookbook;
SOURCE D:/sql/MySQL_cookbook/mysqlcookbook-master/recipes/cookbook.sql;
方法3:修复环境变量
如果仍有问题,临时修改客户端字符集:
cmd
chcp 65001
mysql -u root -p --default-character-set=utf8mb4
重要提示
确保cookbook数据库不存在或可以覆盖:
sql
DROP DATABASE IF EXISTS cookbook;
CREATE DATABASE cookbook CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
如果文件很大(>100MB),建议使用:
cmd
mysql -u root -p --max_allowed_packet=512M --default-character-set=utf8mb4 cookbook < “sql文件路径”
检查文件完整性:
确保文件没有在Windows编辑器中意外被保存为UTF-8 with BOM格式
用十六进制编辑器检查文件开头是否有EF BB BF序列(BOM标记)
请尝试以上方法后告知结果,如果仍有问题,可能需要检查文件传输过程中是否损坏(比对MD5校验值)。
mysql> show tables;
+-----------------------+
| Tables_in_cookbook |
+-----------------------+
| actors |
| adcount |
| al_winner |
| app_log |
| artist |
| book_authors |
| book_vendor |
| booksales |
| catalog_list |
| cd |
| city |
| color |
| cow_color |
| cow_order |
| date_val |
| datetbl |
| datetime_val |
| die |
| doremi |
| drawing |
| driver_log |
| expt |
| formula1 |
| goods_characteristics |
| goods_shops |
| groceries |
| groceries_order_items |
| hitcount |
| hitlog |
| hostip |
| hostname |
| housewares |
| housewares2 |
| housewares3 |
| housewares4 |
| httpdlog |
| httpdlog2 |
| hw_category |
| image |
| ingredient |
| insect |
| inv_item |
| invoice |
| item |
| limbs |
| mail |
| mail_view |
| marathon |
| mark_log |
| metal |
| money |
| movies |
| movies_actors |
| movies_actors_link |
| mytable |
| name |
| news |
| newsstaff |
| numbers |
| obs |
| occasion |
| painting |
| passtbl |
| passwd |
| patients |
| perl_session |
| person |
| php_session |
| phrase |
| player_stats |
| player_stats2 |
| poi |
| poll_vote |
| profile |
| profile_contact |
| rainfall |
| rand_names |
| rank |
| ranks |
| reviews |
| roster |
| ruby_session |
| sales_region |
| sales_tax_rate |
| sales_volume |
| sibling |
| some table |
| standings1 |
| standings2 |
| states |
| str_val |
| sundays |
| taxpayer |
| testscore |
| testscore_withmisses |
| testscore_withmisses2 |
| time_val |
| tmp |
| tomcat_role |
| tomcat_session |
| tomcat_user |
| top_names |
| trip_leg |
| trip_log |
| tsdemo |
| weatherdata |
| weekday |
+-----------------------+
107 rows in set (0.00 sec)
小迪后续建议:
验证数据完整性
可以简单检查几个关键表,确保数据完整:
sql
USE cookbook;
SHOW TABLES; – 确认表数量
SELECT COUNT(*) FROM 某重要表; – 抽查数据量
字符集统一方案
为避免未来出现类似问题,可以在my.ini中添加:
ini
[client]
default-character-set=utf8mb4
备份小技巧
下次导出时建议使用:
bash
mysqldump -u root -p --default-character-set=utf8mb4 cookbook > backup.sql
https://blog.csdn.net/u011868279/category_11645577.html
``sql
D:\software\MySql\bin>mysql -u root -p cookbook < D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql
Enter password: ****
ERROR 1050 (42S01) at line 1073: Table 'limbs' already existsD:\software\MySql\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 8.0.40 MySQL Community Server - GPLCopyright (c) 2000, 2024, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database |
+--------------------+
| cookbook |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)mysql> use cookbook
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_cookbook |
+-----------------------+
| actors |
| adcount |
| al_winner |
| app_log |
| artist |
| book_authors |
| book_vendor |
| booksales |
| catalog_list |
| cd |
| city |
| color |
| cow_color |
| cow_order |
| date_val |
| datetbl |
| datetime_val |
| die |
| doremi |
| drawing |
| driver_log |
| expt |
| formula1 |
| goods_characteristics |
| goods_shops |
| groceries |
| groceries_order_items |
| hitcount |
| hitlog |
| hostip |
| hostname |
| housewares |
| housewares2 |
| housewares3 |
| housewares4 |
| httpdlog |
| httpdlog2 |
| hw_category |
| image |
| ingredient |
| insect |
| inv_item |
| invoice |
| item |
| limbs |
| mail |
| mail_view |
| mytable |
| profile |
| profile_contact |
| some table |
| taxpayer |
+-----------------------+
52 rows in set (0.00 sec)
mysql> source D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql;
--------------
mysql Ver 8.0.40 for Win64 on x86_64 (MySQL Community Server - GPL)Connection id: 19
Current database: cookbook
Current user: root@localhost
SSL: Cipher in use is TLS_AES_256_GCM_SHA384
Using delimiter: ;
Server version: 8.0.40 MySQL Community Server - GPL
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: gbk
Conn. characterset: gbk
TCP port: 3306
Binary data as: Hexadecimal
Uptime: 6 days 22 hours 53 min 31 secThreads: 2 Questions: 855 Slow queries: 0 Opens: 202 Flush tables: 3 Open tables: 120 Queries per second avg: 0.001
--------------ERROR:
Unknown command '\M'.
ERROR:
Unknown command '\m'.
ERROR 1049 (42000): Unknown database 'ecipescookbook.sql;'
从您提供的错误信息来看,导入过程中出现了几个关键问题:问题分析
字符编码问题:客户端字符集是GBK,而服务器使用utf8mb4这可能导致SQL文件中的某些特殊字符被错误解析路径解析错误:错误显示 Unknown database 'ecipescookbook.sql;',表明MySQL尝试将您的SQL文件名的一部分当作数据库名转义字符问题:\M 和 \m 被当作MySQL命令,但实际可能是文件中的内容解决方案
统一字符集:sql
SET NAMES utf8mb4;
在导入前先执行这条命令,确保客户端、连接和结果使用一致的字符集使用完整路径的正确格式:Windows路径中的反斜杠需要转义或改为正斜杠:sql
source D:/sql/MySQL_cookbook/mysqlcookbook-master/recipes/cookbook.sql
或sql
source D:\\sql\\MySQL_cookbook\\mysqlcookbook-master\\recipes\\cookbook.sql
检查文件内容:
用文本编辑器打开SQL文件,检查开头部分是否有异常内容或特殊字符尝试替代导入方法:bash
mysql -u root -p cookbook --default-character-set=utf8mb4 < "D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql"
分块导入:
如果文件很大,可以尝试用文本编辑器分割成多个小文件分别导入您能否提供SQL文件的开头几行内容?这样我可以更准确地判断问题所在。-- Dump created by MySQL pump utility, version: 8.0.27, Linux (x86_64)
-- Dump start time: Mon Feb 14 02:25:01 2022
-- Server version: 8.0.27SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET @OLD_TIME_ZONE=@@TIME_ZONE;
SET TIME_ZONE='+00:00';
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8mb4;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `cookbook` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
根据您提供的SQL文件开头内容,这是一个由MySQL 8.0.27的pump工具创建的完整数据库转储文件。结合之前的错误信息,以下是解决方案:问题根源
字符集冲突:文件指定了utf8mb4但客户端使用gbk导致特殊字符和转义序列被错误解析Windows路径问题:反斜杠被解释为转义字符客户端版本差异:转储文件来自8.0.27(Linux),您使用的是8.0.40(Windows)完整解决方案
方法1:使用命令行导入(推荐)
cmd
mysql -u root -p --default-character-set=utf8mb4 cookbook < "D:\sql\MySQL_cookbook\mysqlcookbook-master\recipes\cookbook.sql"
方法2:在MySQL客户端中正确导入
先连接到MySQL:cmd
mysql -u root -p --default-character-set=utf8mb4
然后执行:sql
SET NAMES utf8mb4;
USE cookbook;
SOURCE D:/sql/MySQL_cookbook/mysqlcookbook-master/recipes/cookbook.sql;
方法3:修复环境变量
如果仍有问题,临时修改客户端字符集:cmd
chcp 65001
mysql -u root -p --default-character-set=utf8mb4
重要提示
确保cookbook数据库不存在或可以覆盖:sql
DROP DATABASE IF EXISTS cookbook;
CREATE DATABASE cookbook CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
如果文件很大(>100MB),建议使用:cmd
mysql -u root -p --max_allowed_packet=512M --default-character-set=utf8mb4 cookbook < "sql文件路径"
检查文件完整性:确保文件没有在Windows编辑器中意外被保存为UTF-8 with BOM格式用十六进制编辑器检查文件开头是否有EF BB BF序列(BOM标记)请尝试以上方法后告知结果,如果仍有问题,可能需要检查文件传输过程中是否损坏(比对MD5校验值)。```sql
mysql> show tables;
+-----------------------+
| Tables_in_cookbook |
+-----------------------+
| actors |
| adcount |
| al_winner |
| app_log |
| artist |
| book_authors |
| book_vendor |
| booksales |
| catalog_list |
| cd |
| city |
| color |
| cow_color |
| cow_order |
| date_val |
| datetbl |
| datetime_val |
| die |
| doremi |
| drawing |
| driver_log |
| expt |
| formula1 |
| goods_characteristics |
| goods_shops |
| groceries |
| groceries_order_items |
| hitcount |
| hitlog |
| hostip |
| hostname |
| housewares |
| housewares2 |
| housewares3 |
| housewares4 |
| httpdlog |
| httpdlog2 |
| hw_category |
| image |
| ingredient |
| insect |
| inv_item |
| invoice |
| item |
| limbs |
| mail |
| mail_view |
| marathon |
| mark_log |
| metal |
| money |
| movies |
| movies_actors |
| movies_actors_link |
| mytable |
| name |
| news |
| newsstaff |
| numbers |
| obs |
| occasion |
| painting |
| passtbl |
| passwd |
| patients |
| perl_session |
| person |
| php_session |
| phrase |
| player_stats |
| player_stats2 |
| poi |
| poll_vote |
| profile |
| profile_contact |
| rainfall |
| rand_names |
| rank |
| ranks |
| reviews |
| roster |
| ruby_session |
| sales_region |
| sales_tax_rate |
| sales_volume |
| sibling |
| some table |
| standings1 |
| standings2 |
| states |
| str_val |
| sundays |
| taxpayer |
| testscore |
| testscore_withmisses |
| testscore_withmisses2 |
| time_val |
| tmp |
| tomcat_role |
| tomcat_session |
| tomcat_user |
| top_names |
| trip_leg |
| trip_log |
| tsdemo |
| weatherdata |
| weekday |
+-----------------------+
107 rows in set (0.00 sec)
后续建议:
验证数据完整性
可以简单检查几个关键表,确保数据完整:
sql
USE cookbook;
SHOW TABLES; – 确认表数量
SELECT COUNT(*) FROM 某重要表; – 抽查数据量
字符集统一方案
为避免未来出现类似问题,可以在my.ini中添加:
ini
[client]
default-character-set=utf8mb4
备份小技巧
下次导出时建议使用:
bash
mysqldump -u root -p --default-character-set=utf8mb4 cookbook > backup.sql
https://blog.csdn.net/u011868279/category_11645577.html