MySQL字符集中所设定参数
以下的文章主要描述的是MySQL字符集中所设定的所有相关参数UTF8,我们在安装完成之后已经MySQL字符集(和PHP搭配之最佳组合)进行设置 ,把它设置为utf8。具体的操作内容如下,望你会有所领悟。 但是 MySQL(和PHP搭配之最佳组合) SHOWVARIABLESLIKE'collation_
以下的文章主要描述的是MySQL字符集中所设定的所有相关参数UTF8,我们在安装完成之后已经MySQL字符集(和PHP搭配之最佳组合)进行设置 ,把它设置为utf8。具体的操作内容如下,望你会有所领悟。
但是
<ol class="dp-xml"> <li class="alt"><span><span>MySQL(和PHP搭配之最佳组合)</span><span class="tag">></span><span> SHOW VARIABLES LIKE 'collation_%'; </span></span></li> <li><span>+----------------------+-------------------+ </span></li> <li class="alt"><span>| Variable_name | Value | </span></li> <li><span>+----------------------+-------------------+ </span></li> <li class="alt"><span>| collation_connection | latin1_swedish_ci | </span></li> <li><span>| collation_database | utf8_general_ci | </span></li> <li class="alt"><span>| collation_server | utf8_general_ci | </span></li> <li><span>+----------------------+-------------------+ </span></li> <li class="alt"><span>3 rows in set (0.00 sec) </span></li> <li><span> </span></li> <li class="alt"> <span>MySQL(和PHP搭配之最佳组合)</span><span class="tag">></span><span> SHOW VARIABLES LIKE 'character_set_%'; </span> </li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>| Variable_name | Value | </span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>| character_set_client | latin1 | </span></li> <li><span>| character_set_connection | latin1 | </span></li> <li class="alt"><span>| character_set_database | utf8 | </span></li> <li><span>| character_set_results | latin1 | </span></li> <li class="alt"><span>| character_set_server | utf8 | </span></li> <li><span>| character_set_system | utf8 | </span></li> <li class="alt"><span>| character_sets_dir | D:\data\MySQL(和PHP搭配之最佳组合)\MySQL(和PHP搭配之最佳组合) Server 4.1\share\charsets/ | </span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>7 rows in set (0.00 sec) </span></li> </ol>
发觉画线标注的属性还是非 utf8的。
然后修改 my.ini 文件,设置
以下是代码片段:
<ol class="dp-xml"> <li class="alt"><span><span>[client] </span></span></li> <li> <span class="attribute">default-character-set</span><span>=</span><span class="attribute-value">utf8</span><span> </span> </li> <li class="alt"><span>[MySQL(和PHP搭配之最佳组合)] </span></li> <li> <span class="attribute">default-character-set</span><span>=</span><span class="attribute-value">utf8</span><span> </span> </li> <li class="alt"><span>[MySQL(和PHP搭配之最佳组合)d] </span></li> <li> <span class="attribute">default-character-set</span><span>=</span><span class="attribute-value">utf8</span><span> </span> </li> <li class="alt"><span> </span></li> </ol>
copy my.ini 文件到 windows目录
启动MySQL字符集(和PHP搭配之最佳组合) 以下是代码片段:
<ol class="dp-xml"> <li class="alt"><span><span>MySQL(和PHP搭配之最佳组合)</span><span class="tag">></span><span> SHOW VARIABLES LIKE ’character_set_%’; </span></span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>| Variable_name | Value | </span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>| character_set_client | utf8 | </span></li> <li><span>| character_set_connection | utf8 | </span></li> <li class="alt"><span>| character_set_database | utf8 | </span></li> <li><span>| character_set_results | utf8 | </span></li> <li class="alt"><span>| character_set_server | utf8 | </span></li> <li><span>| character_set_system | utf8 | </span></li> <li class="alt"><span>| character_sets_dir | D:\data\MySQL(和PHP搭配之最佳组合)\MySQL(和PHP搭配之最佳组合) Server 4.1\share\charsets/ | </span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>7 rows in set (0.00 sec) </span></li> <li><span> </span></li> <li class="alt"> <span>MySQL(和PHP搭配之最佳组合)</span><span class="tag">></span><span> SHOW VARIABLES LIKE ’character_set_%’; </span> </li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>| Variable_name | Value | </span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>| character_set_client | utf8 | </span></li> <li><span>| character_set_connection | utf8 | </span></li> <li class="alt"><span>| character_set_database | utf8 | </span></li> <li><span>| character_set_results | utf8 | </span></li> <li class="alt"><span>| character_set_server | utf8 | </span></li> <li><span>| character_set_system | utf8 | </span></li> <li class="alt"><span>| character_sets_dir | D:\data\MySQL(和PHP搭配之最佳组合)\MySQL(和PHP搭配之最佳组合) Server 4.1\share\charsets/ | </span></li> <li><span>+--------------------------+------------------------------------------------+ </span></li> <li class="alt"><span>7 rows in set (0.00 sec) </span></li> </ol>
一切正常了。创建数据库:以下是代码片段:
<ol class="dp-xml"> <li class="alt"><span><span>create table t_sysuser ( </span></span></li> <li><span>USERID integer not null auto_increment, </span></li> <li class="alt"><span>USERNAME varchar(30), </span></li> <li><span>PASSWORDS varchar(30), </span></li> <li class="alt"><span>DEPTNO varchar(30), </span></li> <li><span>HEADSHIP varchar(30), </span></li> <li class="alt"><span>SEX varchar(4), </span></li> <li><span>TEL varchar(18), </span></li> <li class="alt"><span>EMAIL varchar(30), </span></li> <li><span>URL varchar(30), </span></li> <li class="alt"><span>PCALL varchar(20), </span></li> <li><span>USERPHOTO varchar(255), </span></li> <li class="alt"><span>FACEREFUTIME integer, </span></li> <li><span>FACELANGUAGE varchar(1), </span></li> <li class="alt"><span>LASTMODIF varchar(30), </span></li> <li><span>LASTMDATE datetime, </span></li> <li class="alt"><span>CREADTOR varchar(30), </span></li> <li><span>CREATDATE datetime, </span></li> <li class="alt"><span>Prima(最完善的虚拟主机管理系统)ry key (USERID) </span></li> <li> <span>) </span><span class="attribute">ENGINE</span><span>=</span><span class="attribute-value">InnoDB</span><span> DEFAULT </span><span class="attribute">CHARSET</span><span>=</span><span class="attribute-value">utf8</span><span>; </span> </li> </ol>
全部搞定。

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

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

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.

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.

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.

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app
