Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Modification method of Table and Field Code in mysql Database

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the "mysql database table and field coding modification method" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

There is garbled when loading data with load data infile. When using load, the encoding of the database table field must be the same as that of the file, but the database already has data that you do not want to rebuild. It is a good choice to modify the code with the command. Here is the way to modify it. Tried to modify my.iniri character _ set_database = uft8, but it didn't seem to work.

1. If the code for installing mysql can no longer be changed, many friends buy a virtual host to set up a website and have no right to change the installation code of MYSQL. We can skip this pass, because as long as the following steps are correct, we can also solve the problem of garbled code.

two。 Modify the database code. If the database code is incorrect, you can execute the following command in phpmyadmin: ALTER DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin

The above command sets the encoding of the test database to utf8

3. Modify the encoding of the table: ALTER TABLE `roomy` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin

The above command is to change the encoding of a table category to utf8

4. Modify the encoding of the field:

ALTER TABLE `test`CHANGE `dd``dd` VARCHAR (45) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL

The above command is to change the field encoding of dd in the test table to utf8

This is the end of the content of "the modification method of mysql database table and field coding". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report