mysql编码怎么设置步骤?
mysql的默认编码是拉丁,每次JSP制作网页用insert语句插入数据库时汉字都会显示成问号,安装mysql后,启动服务并登陆,使用show variables命令可查看mysql数据库的默认编码: 由上图可见database和server的字符集使用了latin1编码方式,不支持中文,即存储中
mysql的默认编码是拉丁,每次JSP制作网页用insert语句插入数据库时汉字都会显示成问号,安装mysql后,启动服务并登陆,使用show variables命令可查看mysql数据库的默认编码:
由上图可见database和server的字符集使用了latin1编码方式,不支持中文,即存储中文时会出现乱码。以下是命令行修改为utf-8编码的过程,以支持中文。
(1)关闭mysql服务
[plain] view plaincopy
service mysql stop
(2)修改 /etc/mysql/my.cnf (默认的安装路径)
[plain] view plaincopy
vim /etc/mysql/my.cnf
打开my.cnf后,在文件内的[mysqld]下增加如下两行设置:
[plain] view plaincopy
character_set_server=utf8
init_connect='SET NAMES utf8'
(具体如截图所示):
保存退出。
(3) 重新启动mysql服务
[plain] view plaincopy
service mysql start
至此,完成修改默认编码,登陆mysql后重新使用show variable like '%character%'获得的输出效果如下:
注
具体操作和输出情况如下:
解决方法:打开mysql安装目录:C:Program FilesMySQLMysql server5.5
打开文件my.ini配置文件,找到 default-character-set=latin1 并改为:
default-character-set=gbk,找到 character-set-server=latin1 并改为:
character-set-server=gbk,修改完之后保存。
最后:我的电脑右击 “管理”进入之后选择“服务和应用程序”下的“服务”
找到“mysql”之后右击选择“重新启动”。
把jsp页面中的odin g="ISO-8859-1"%>改为
,
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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

When logging into iTunesStore using AppleID, this error saying "This AppleID has not been used in iTunesStore" may be thrown on the screen. There are no error messages to worry about, you can fix them by following these solution sets. Fix 1 – Change Shipping Address The main reason why this prompt appears in iTunes Store is that you don’t have the correct address in your AppleID profile. Step 1 – First, open iPhone Settings on your iPhone. Step 2 – AppleID should be on top of all other settings. So, open it. Step 3 – Once there, open the “Payment & Shipping” option. Step 4 – Verify your access using Face ID. step

WeChat is one of the social media platforms in China that continuously launches new versions to provide a better user experience. Upgrading WeChat to the latest version is very important to keep in touch with family and colleagues, to stay in touch with friends, and to keep abreast of the latest developments. 1. Understand the features and improvements of the latest version. It is very important to understand the features and improvements of the latest version before upgrading WeChat. For performance improvements and bug fixes, you can learn about the various new features brought by the new version by checking the update notes on the WeChat official website or app store. 2. Check the current WeChat version We need to check the WeChat version currently installed on the mobile phone before upgrading WeChat. Click to open the WeChat application "Me" and then select the menu "About" where you can see the current WeChat version number. 3. Open the app

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

Can't enable Wi-Fi calling on iPhone? Call quality is improved and you can communicate even from remote locations where cellular networks are not as strong. Wi-Fi Calling also improves standard call and video call quality. So, if you can't use Wi-Fi calling on your phone, these solutions might help you fix the problem. Fix 1 – Enable Wi-Fi Calling Manually You must enable the Wi-Fi Calling feature in your iPhone settings. Step 1 – For this, you have to open Settings. Step 2 – Next, just scroll down to find and open the “Phone” settings Step 3 – In the phone settings, scroll down and open the “Wi-Fi Calling” setting. Step 4 – In the Wi-Fi Calling page, change “This iPhone

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

Is the Clear History button gray in Safari on iPhone? If this is the case, you won't be able to clear history in Safari at all. Stored cookies and website data may cause unsolicited events in your browser. However, if you follow the steps below, you can easily resolve the issue and delete stored user history from Safari. Fix 1 – Disable Content Restrictions Content restrictions on iPhone may limit the correct use of Safari browser. Step 1 – Open iPhone settings. Step 2 – Next, go to Screen Time settings. Step 3 – In Screen Time settings, turn on Content & Privacy Restrictions
