In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In the process of development, if the database data is garbled after restoring the MySQL database, it can be solved by modifying the default code of the database.
The following example demonstrates the modification process by changing the default code of MySQL to UTF-8:
1. Check the information of mysql first
# View the database installation location whereis mysql # log in to the database mysql-u root-p enter the password as prompted # View mysql status mysql > status
2. Modify my.cnf file
The directory is / etc/my.cnf
If there is no my.cnf file in the system, you need to create this file. For specific steps, please see 3. If there is, skip step 3 and proceed directly to step 4.
3. Find the file at the end of .cnf
Command find /-iname * .cnf-print
The result is shown in the figure:
Copy any file in the above search result set / usr/share/mysql directory to the / etc/ directory
Command: cp / usr/share/mysql/my-large.cnf / etc/my.cnf
4. Edit the my.cnf file
Command: vi / etc/my,cnf
Add under [client]
Default-character-set=utf8
Add under [mysqld]
Character_set_server=utf8
It is possible that the above modification method does not take effect because of the different version of MySQL.
In the process of actual use, basically most of the MySQL will take effect, and I have only encountered one modification that was not successful, and the specific reason has not yet been identified due to the restrictions at that time.
If anyone knows the reason, please let me know. I would appreciate it.
In addition, if the above modification really does not take effect, please change the line under [mysqld] to the following line
Default-character-set=utf8
5. Restart mysql
Service mysql restart
At this point, after logging in to mysql, you can use show variables like "character%"; to view the modification result. If the result is consistent with the modified target code, congratulations, the modification is successful!
Summary
The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.
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.