mysql 字符集问题
字符集出现错误解决办法
出现的问题:
mysql> update users
-> set username='关羽'
-> where userid=2;
ERROR 1366 (HY000): Incorrect string value: '\xB9\xD8\xD3\xF0' for column 'usern
ame' at row 1
向表中插入中文字符时,出现错误。
mysql> select * from users;
+--------+----------+
| userid | username |
+--------+----------+
| 2 | ???? |
| 3 | ???? |
| 4 | ?í?ù |
+--------+----------+
3 rows in set (0.00 sec)
表中的中文字符位乱码。
解决办法:
使用命令:
mysql> status;
--------------
mysql Ver 14.12 Distrib 5.0.45, for Win32 (ia32)
Connection id: 8
Current database: test
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: gbk
Conn. characterset: gbk
TCP port: 3306
Uptime: 7 hours 39 min 19 sec
Threads: 2 Questions: 174 Slow queries: 0 Opens: 57 Flush tables: 1 Open ta
bles: 1 Queries per second avg: 0.006
--------------
查看mysql发现Server characterset,Db characterset的字符集设成了latin1,所以出现中文乱码。
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| users |
+----------------+
1 row in set (0.00 sec)
更改表的字符集。
mysql> alter table users character set GBK;
Query OK, 3 rows affected (0.08 sec)
Records: 3 Duplicates: 0 Warnings: 0
-----------------------------------------------------------------------------------------------------------------------------------
(1)修改 MySql安装目录下面的my.ini(MySQL Server Instance Configuration 文件)。 设置
default-character-set=gbk(注意,有2处)
(2)修改data目录中相应数据库目录下的db.opt配置文件
default-character-set=gbk
default-collation=gbk_chinese_ci
重启数据库,关闭控制台窗口重新登录数据库,执行SQL,一切正常
Jan 27, 2021 09:55:23 PM
As a MySQL developer, this is very helpful for me. Vegan Protein Pancakes There are loads of things to learn from this. Also the solutions for many database MySQL encoding. They provide different FAQs here. Great platform to learn. I appreciate the creator of this.
Jul 17, 2021 05:43:35 PM
Vijayalakshmi Medical Centre has completed 10 years of success in the field of gynaecology and infertility. We are the best among the first ivf treatment cost in kerala few comprehensive dedicated infertility hospitals in Asia. Our expertise in the field of infertility has made us come forward with an exclusive department in our hospital. We are delighted to present our infertility department ‘Babycart’.
Dec 18, 2023 06:23:40 PM
Thanks for taking the time to discuss this, I really feel strongly about it and love learning extra on this topic. If attainable, as you achieve experience, would you thoughts updating your blog with additional data? It is extremely useful for me. 攝影器材
============================
I am glad that I found this website , exactly the right information that I was searching for! . 腳架
Dec 21, 2023 11:48:17 PM
This is great content. You’ve loaded this with useful, informative content that any reader can understand. I enjoy reading articles that are so very well-written. collagen tablets
====================
Outstanding post, I conceive people should larn a lot from this web site its really user genial . collagen powder
====================
i would have to make more christmas cards becuase next month is december already- Sub-Zero appliance repair near me
Dec 22, 2023 03:47:38 PM
Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your site? My blog is in the very same niche as yours and my visitors would certainly benefit from a lot of the information you provide here. Please let me know if this alright with you. Thanks a lot! Bolsas de papel personalizables
=============================
*Nice post. I discover some thing much harder on various blogs everyday. Most commonly it is stimulating to study content from other writers and exercise a specific thing from their website. I’d opt to apply certain while using the content in this little blog whether or not you do not mind. Natually I’ll provide a link on your own internet weblog. Appreciate your sharing. atomo hd
Dec 23, 2023 10:31:17 PM
hello!,I like your writing so much! share we communicate extra approximately your post on AOL? I need an expert in this space to solve my problem. Maybe that is you! Looking ahead to see you. NANOFILTRATION ULTRAFILTRATION SYSTEMS MANUFACTURER NF UF MF FILTRATIONS SYSTEMS FOR WATER FILTRATION
Dec 26, 2023 12:30:22 AM
All you need to know about News information to you. DESALINATION PLANT MANUFACTURER
Feb 15, 2024 02:45:07 PM
Mariah Carey's illustrious career spans over three decades, establishing her as a global icon in the music industry. Firstly, her five-octave vocal range has captivated audiences worldwide, earning her the title of the "Songbird Supreme." Secondly, Carey's songwriting prowess is evident in her chart-topping hits, showcasing her ability to craft timeless and emotive lyrics. Thirdly, her record-breaking success includes numerous Billboard Hot 100 chart-toppers and accolades like Grammy Awards. Additionally, Carey's influence extends beyond music, as she's also made her mark in acting and philanthropy. Furthermore, her holiday classic, "All I Want for Christmas Is You," remains a perennial favorite. In conclusion, Mariah Carey's multifaceted talent, enduring appeal, and unmatched vocal ability make her a true legend in the entertainment industry.
Mar 07, 2024 11:34:51 PM
Exploring the Best Cannabis Products in California
California stands as a cannabis enthusiast's paradise, boasting a vibrant market filled with diverse cannabis products. From edibles to topicals, the options are endless. Firstly, consider exploring the extensive range of high-quality strains available in dispensaries across the state. Next, immerse yourself in the world of innovative cannabis-infused edibles, ranging from gourmet chocolates to savory snacks. Moreover, California offers a plethora of top-notch CBD products, providing therapeutic benefits without the psychoactive effects. In addition, indulge in the luxury of premium vape cartridges, known for their convenience and potency. Lastly, don't miss out on the wellness potential of cannabis topicals, offering localized relief. California's cannabis market ensures a diverse and exciting journey for enthusiasts.
Mar 12, 2024 07:07:28 AM
Looking for remote bookkeeping jobs? In today's digital age, opportunities abound for skilled professionals seeking flexibility and autonomy in their careers. Remote bookkeeping jobs offer a perfect solution, allowing individuals to manage financial records and transactions from the comfort of their homes. Embrace the freedom of working independently while contributing to the financial health of diverse businesses. Explore job platforms and websites dedicated to connecting employers with qualified remote bookkeepers. Stay updated on the latest accounting software and technologies to enhance your marketability. With the rise of remote work, seize the chance to balance your career and lifestyle by diving into the world of remote bookkeeping jobs.
Apr 01, 2024 05:26:18 AM
Testosterone therapy is a medical treatment used to address low levels of testosterone in men. This therapy involves administering testosterone through injections, patches, gels, or implants to restore normal levels of the hormone in the body. Benefits of testosterone therapy include increased libido, improved mood, and enhanced muscle mass. However, it's crucial to undergo proper evaluation by a healthcare professional before starting this treatment to assess its suitability and potential risks. Monitoring of testosterone levels during therapy is essential to ensure effectiveness and safety. Regular check-ups also help in managing any potential side effects and adjusting the treatment plan accordingly.
Apr 21, 2024 05:07:29 PM
Natürlich, hier sind 100 Wörter zu Ihrem Thema:
Wenn Sie nach einer Weed-Lieferung in meiner Nähe suchen, gibt es einige wichtige Schritte zu beachten. Zuerst sollten Sie nach lokalen Weed-Lieferdiensten in Ihrer Nähe suchen (Lokale Lieferdienste finden), um festzustellen, welche Optionen verfügbar sind. Überprüfen Sie dann die Produktvielfalt und -qualität (Produktauswahl überprüfen), um sicherzustellen, dass Ihre bevorzugten Sorten verfügbar sind. Stellen Sie sicher, dass der Lieferdienst alle rechtlichen Anforderungen erfüllt (Rechtliche Standards überprüfen), um eine sichere und legale Transaktion zu gewährleisten. Achten Sie auch auf die Lieferzeiten und -gebühren (Lieferzeiten und -gebühren überprüfen), um Ihre Bestellung rechtzeitig zu erhalten. Schließlich können Sie die Bestellung aufgeben und Ihre Weed-Lieferung in Ihrer Nähe erhalten (Bestellung aufgeben).
May 29, 2024 01:16:46 PM
Bookkeeping services are essential for businesses to maintain accurate financial records. These services encompass a range of tasks, including recording transactions, reconciling accounts, and generating financial reports. By outsourcing bookkeeping services, businesses can focus on core activities while ensuring their financial affairs are in order. Professional bookkeeping services offer expertise in accounting software and regulations, ensuring compliance and accuracy. They provide timely insights into financial performance, enabling informed decision-making. Additionally, bookkeeping services help streamline tax preparation and audit processes, reducing stress and potential errors. Embracing professional bookkeeping services fosters financial stability and growth for businesses of all sizes.
Aug 24, 2024 02:37:17 PM
For superior Solar Panel Cleaning, our services are unmatched. We specialize in thorough panel washing to remove dirt and debris that can affect efficiency. Our team uses eco-friendly cleaning solutions and advanced equipment to ensure a spotless finish without damaging your panels. We handle both residential and commercial installations, providing regular maintenance to keep your system performing at its best. With experienced technicians, we offer affordable rates and flexible scheduling to meet your needs. Trust us for all your solar panel cleaning requirements and boost your energy efficiency with pristine, clean panels.
Oct 13, 2024 03:49:07 PM
Workshop Repair Manuals download offers an efficient way to access crucial repair information for your vehicle.
Convenience: With a Workshop Repair Manuals download, you get instant access to the repair guide without waiting for physical delivery.
Comprehensive Instructions: These manuals provide detailed step-by-step instructions for diagnostics and repairs, covering a wide range of vehicle models.
Portable: Once downloaded, you can access the manual from any device, making it perfect for use in the garage or on the go.
Cost-effective: A Workshop Repair Manuals download is often more affordable than printed manuals, saving you money while offering the same valuable content.
Oct 13, 2024 10:08:11 PM
Workshop Repair Manual: Your Complete Repair Companion
Comprehensive Instructions: A Workshop Repair Manual offers detailed, model-specific instructions for all types of repairs.
Step-by-Step Guidance: With easy-to-follow, step-by-step procedures, a Workshop Repair Manual simplifies even complex repair tasks.
Accurate Diagrams: Get access to detailed diagrams and illustrations that help you understand parts and systems clearly.
Troubleshooting Tips: A Workshop Repair Manual includes troubleshooting sections to help quickly diagnose and solve problems.
Perfect for All Skill Levels: Whether you're a professional mechanic or a DIY enthusiast, a Workshop Repair Manual is an essential tool for successful repairs.