In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Solve the problem of importing MYSQL data from high version to low version [@ more@] recently, the author encountered the problem of importing MYSQL data from high version to low version. Such a problem is generally due to different settings for high and low versions of the character set. According to the usual practice, after exporting the data with the mysqldump command, you can use the file editor (editplus) to modify the corresponding "DEFAULT CHARSET=gb2312" part, and you can successfully import the lower version of MySQL. But when you encounter a lot of data (millions), this approach is a drop in the bucket! So what do we do? Now I will summarize the solutions of importing MYSQL data from high version to low version when I encounter in my work.
Method 1: (suitable for when the amount of exported data is small)
Step 1: export to SQL text from the source server using the mysqldump command
Mysqldump-hsrc_dbserver-uroot-p testdb > testdb.sql
Step 2: use a text editor such as editplus, open testdb.sql, type the content that needs to be modified, such as DEFAULT CHARSET=gb2312, and change it to the character set corresponding to the target server. Save it.
Step 3: use the mysql command to import the modified SQL text into the target server. OK!
Mysql-hdest_dbserver-uroot-p testdb
< testdb.sql 方法二:(适用于当导出的数据量很大时,如万级,百万级数据) step 1:在mysql命令模式下,使用show variables 命令查看一下目标服务器的字符集设置情况和MYSQL版本 step 2:使用如下命令: mysqldump --compatible=mysql323 -hsrc_dbserver -uroot -p --default-character-set=latin1 testdb >Testdb.sql
Where-- compatible=mysql323 refers to the version of the target server and-- default-character-set=latin1 refers to the character set setting of the target server
Step 3: import the exported SQL text into the target server using the mysql command. OK! The great task has been completed!
Mysql-hdest_dbserver-uroot-p testdb < testdb.sql
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.