In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
There are two ways for mysql to execute sql scripts:
Method 1:
Under the console, go to the bin directory of mysql
Mysql-u user-p "password"-P 3308-D testdb
< d:\test\test.sql 这里的test.sql是待执行的sql脚本,记得要写绝对路径。 方式2: 进入mysql的执行命令行下,用source命令执行: Mysql>Source d:\ test\ test.sql
Or
Mysql >\. D:\ test\ test.sql
Question:
When executing the sql script in mode 1, the error is as follows:
I checked this error on the Internet, which is in terms of character set. However, when I try to separate the sql statements in test.sql and execute them on the Navicat client, or in the following way:
Mysql-u user-p "password"-P 3308-D testdb-e "update * * set col1="; "
It was found that all of them were carried out successfully.
This shows that there is nothing wrong with the sql script itself. So the problem may lie in the coding format of the sql script.
After checking, I found that because my sql script was written in txt, the default encoding format was ansi when I saved it. So re-save it as follows:
Select the encoding format as utf8. Execute it again, success.
Note: if the sql script to be executed contains Chinese characters, you need to pay attention to the encoding format of the script.
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.