The following articles mainly explain how to solve the garbled problem and installation failure caused by UTF8 database installed at MySQL4.1 or above for H. The following is a description of the specific content of the article, I hope you will understand the actual operations after browsing.
These days I have tried installing mambo 4.53h, because my database is mysq4.1 or later and the Set character set is UTF8. After several installation attempts, the following situations are found:
1. set the database to latin1 without modifying any files. During installation, the installation can be completed no matter whether gb2312 or utf8 is selected, and the webpage is displayed normally. However, it is found that when you read the data table through phpmyadmin, all Chinese characters in the table are garbled. That is to say, the Chinese webpage can be displayed normally after being saved using the latin1 character set, but Chinese characters are garbled in the database.
In addition, files backed up by phpmyadmin cannot be backed up. No matter what encoding is changed, Chinese characters in the files are garbled ). So this is not king, and I did not make a choice.
2. Set the database character set to utf8 without modifying any files. During installation, the error 1071 specified key too long max length 1000 bytes occurs no matter whether gb2312 or utf8 is selected. In addition, as long as the database character set is set to utf8, utf8 is a character set as 3 bytes storage, and latin1 is as 1 bytes storage), No matter according to some comments in the Forum, modify installation/SQL/mambo. SQL or other files may encounter an error where the key exceeds bytes. The installation cannot continue.
I meant to install the Chinese utf8 version of manbo to facilitate integration with other programs. After searching google, forums, and other materials, I tried to use my ideas to select the utf8 Character Set of manbo to be above MySQL4.1, the character set is also installed successfully in the utf8 database.
The webpage displays normal Chinese characters without garbled characters. When you use phpmyadmin to query database tables, all Chinese characters are displayed normally and saved in utf8. The following are my solutions for your reference only:
First, set the database character set to utf8,
- CODE:[Copy to clipboard]ALTER DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
You can also directly change it in phpmyadmin.
Modify the installation/SQL/mambo. SQL file:
Find all
- CODE:[Copy to clipboard]TYPE=MyISAM;
Replace
- CODE:[Copy to clipboard]TYPE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Search
- CODE:[Copy to clipboard]UNIQUE KEY `section_value_value_aro` (`section_value`,`value`)
And
- CODE:[Copy to clipboard]UNIQUE KEY `#__gacl_section_value_value_aro` (`section_value`,`value`),
And comment out or delete the two lines of code with #. whatever ~~
In this Code section
- CODE:[Copy to clipboard]# Table structure for table `#__core_acl_aro_groups`
The following four lines of code are added in sequence:
CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'Chang' section _ value' VARCHAR (240) character set latin1 COLLATE latin1_bin not null default '0 ';
CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'change 'value' value' VARCHAR (240) character set latin1 COLLATE latin1_bin not null default '';
CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'add UNIQUE 'section _ value_value_aro' ('section _ value', 'value ');
CODE: [Copy to clipboard] alter table '#__ core_acl_aro 'add unique' #__ gacl_section_value_value_aro' ('section _ value', 'value ');
Modify the replicdes/database. php file:
Search
- CODE:[Copy to clipboard]$this->_table_prefix = $table_prefix;
Add the following three lines of code under this line:
- CODE: [Copy to clipboard] MySQL (the best combination with PHP) _ query ("set names 'utf8'", $ this-> _ resource );
- CODE: [Copy to clipboard] MySQL (the best combination with PHP) _ query ("set character set utf8", $ this-> _ resource );
- CODE: [Copy to clipboard] MySQL (the best combination with PHP) _ query ("SET COLLATION_CONNECTION = 'utf8 _ general_ci '", $ this-> _ resource );
Save the modification.
During installation, select UTF8 as the encoding format.
After the modification, the system can be installed normally and the Chinese characters in the database can be displayed and saved normally. If you need to integrate discuz or other programs, you can also select the UTF8 version, after integration, Chinese user names are not used during registration, but garbled characters are displayed after registration.
Notes
After this method is modified, modify the mongodes/database. php when upgrading manbo. Otherwise, an error occurs.
The above modification method is based on several experts in the Forum, some English documents found through google search, and some documents from TW manbo, after the modification is attempted and tested, there is no problem. I hope it will be helpful for friends who encounter the same problem! A useful friend is worthy of the many things I have written.
The above content is an introduction to how to install MySQL for h. I hope you will gain some benefits.