JSP使用UTF-8链接MYSQL数据库(UTF8)乱码以及连接失败问题:
前言,服了这些大公司,做的数据库都不人性化。。。我忙了很久才搞定的说
csdn好像传不了图片了。。。本来想来几张的,大家将就。。。
1.在windows下mysql的数据库是utf8编码的时候,连接失败(注意mysql中不是UTF-8,而是utf8)
情况,显示?在网页上(网页设置的UTF-8编码)
用户ID号码 用户名称 用户密码 用户地址 47 g? 1243 null 48 ? 1243 null 49 ?123 1243 null 50 ?23 1243 null 51 ?3 1243 null在数据库设定客户端的语言为GBK可以显示,猜测是内部采用utf8编码,设定之后会自定转换成为GBK编码:
mysql> set names gbk
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from user;
+--------+-----------+--------------+------------+
| userid | username | userpassword | useradress |
+--------+-----------+--------------+------------+
| 1 | 我 | NULL | NULL |
| 2 | ?2 | 1243 | NULL |
| 3 | ??37fg459 | 1243 | NULL |
当然,用utf8编码的换,一定会乱码的,猜测是windows默认编码是GBK,所以utf是显示不了的。
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from user;
+--------+-----------+--------------+------------+
| userid | username | userpassword | useradress |
+--------+-----------+--------------+------------+
| 1 |

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version
SublimeText3 Linux latest version
