Required knowledge: mysql encoding: installation directory in mysql, for example, E: ProgramFilesMySQLMySQLServer5.0my. ini can find the mysql library encoding, in most cases, can be set to uft-8: default-character-setutf8 or gbk: default-character-setgbk encoding is incorrect, it will cause a failure to import. after modifying the Encoding
Required knowledge: mysql encoding: installation directory in mysql, such as: E: \ Program Files \ MySQL Server 5.0 \ my. ini can find the mysql library encoding, in most cases, can be set to uft-8: default-character-set = utf8 or gbk: default-character-set = gbk encoding is incorrect, the data cannot be imported. after modifying the Encoding
Required knowledge:
Mysql encoding:
In the mysql installation directory, for example:
E: \ Program Files \ MySQL Server 5.0 \ my. ini
You can find the mysql library encoding, in most cases, can be set to uft-8:
Default-character-set = utf8
Or gbk:
Default-character-set = gbk
If the encoding is incorrect, the data cannot be imported. After the encoding is modified, the database must be restarted to take effect.
1. condition: on the same server,
Mysql databases can be backed up and restored using the Export and Import functions of the platform.
2. condition: When my. ini encoding is consistent on different servers,
Mysql databases can be backed up and restored using the Export and Import functions of the platform.
2. condition: When my. ini encoding is inconsistent on different servers,
You must change my. ini to a consistent encoding before using the Export and Import functions of the platform to back up and restore data.
3. For Files imported using phpmyadmin or other tools, you need to re-process the files before using the import function of the Platform:
Take phpmyadmin as an example. After exporting, save the generated SQL statement as a. SQL file and modify it in Notepad:
(1) Find the line starting with "create database", for example:
Create database 'database name' default character set latin1 COLLATE latin1_swedish_ci;
Add the -- symbol to cancel the operation permission of this line (the reason is that the import is from the perspective of a common user and the database cannot be created)
In this way, it is possible to use the import function of the platform to import data.
(2) then, you can check whether the encoding of this library is consistent with that on your server.
If the encoding is inconsistent,
<1> you can use phpmymyadmin to back up the file to a. SQL file that is encoded in the same way. (You can select encoding on the homepage of phpmyadmin)
<2> either modify my. ini encoding, and restart Mysql to import (restart Mysql on the server, management tools, and service management). This method has a higher chance of success. We recommend that you do this.
----- Note: If the Import fails due to incorrect encoding, you need to clear the database to perform the next import (the master version after-6-12 has the function of clearing the database panel )------
Take the discuz Forum as an Example
If you installed a forum of the GBK version,
After being exported using phpmyadmin, the encoding is GBK,
To import data to another server, you must set "default-character-set = gbk" in "my. ini" and restart mysql to import data to the platform.
Supplement:
When restoring a database using mysql or restoring a backup using The off-star background, The following Error occurs: The MySQL Server returned this Error: mySQL Error Nr.2006-MySQL server has gone away. This error occurs when a MB backup is restored. The solution is to find the mysql installation directory, find the my. ini file, and add max_allowed_packet = 100 M at the end of the file (you can also set the desired size ). The max_allowed_packet parameter is used to control the maximum length of the Communication buffer. (This content is provided by user 9du01)