After migrating a set of internal systems (confluence), the page opened and found that the question mark was garbled. Analysis Reason:
I created the database in the following way:
Mysql> CREATE database Confluence character set UTF8 collate utf8_bin;
Query OK, 1 row Affected (0.00 sec)
Mysql> Grant all on conflence.* to ' confluence ' @ ' percent ' identified by ' 456456 ';
Query OK, 0 rows Affected (0.00 sec)
Mysql> Grant all on confluence.* to ' confluence ' @ ' localhost ' identified by ' 456456 ';
Query OK, 0 rows Affected (0.00 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Already set the character set to Utf-8, why still garbled.
Look at the encoding format of the database as follows:
Mysql> Show variables like '%char% ';
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | UTF8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | Latin1 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+
8 rows in Set (0.00 sec)
To find the cause of the problem, Character_set_server does not support UTF8, modifies the MySQL configuration and reloads it.
/etc/init.d/mysqld stop
Vi/etc/my.cnf
Add to:
Character_set_server=utf8
init_connect= ' SET NAMES UTF8 '
3./etc/init.d/mysqld Start
To view the database encoding character set:
Mysql> Show variables like '%char% ';
+--------------------------+----------------------------+
| variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | UTF8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | UTF8 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|
+--------------------------+----------------------------+
8 rows in Set (0.00 sec)
Re-import the previous data, the interface returned to normal.
Tips:
Be sure to modify the URL when configuring confluence to connect to the MySQL database:
Original such as:
Jdbc:mysql://localhost/confluence?sessionvariables=storage_engine%3dinnodb</property>
Have Chinese, must let it support UTF8, otherwise the default is latin1, need to modify the name as follows:
Jdbc:mysql://localhost/confluence?autoreconnect=true&useunicode=true&characterencoding=utf8 &sessionVariables=storage_engine%3DInnoDB</property>
Using Unicode encoding, the character encoding is UTF-8 and is automatically re-connected.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/76/D3/wKiom1ZdOOKQVjUdAABtqG9Djac862.png "title=" Haha.png "alt=" Wkiom1zdookqvjudaabtqg9djac862.png "/>
This article is from the "7159900" blog, please be sure to keep this source http://7169900.blog.51cto.com/7159900/1718486
Troubleshooting MySQL database does not support Chinese