Install and configure MySQL decompress version in Windows
1. Download MySQL extract version to the official website, and then extract mysql to any path, this example in: D: \ Program Files \ mysql-advanced-5.6.14-win32
2. Set environment variables, add:; D: \ Program Files \ mysql-advanced-5.6.14-win32 \ bin in the system variable Path
3. There is an ini file starting with "my-" under the root directory, copy a file at will put in the root directory, such as: my-default.ini, change the file name to my. ini, add the following content:
[Mysqld]
# Set the character set to utf8
Default-character-set = utf8
Basedir = D:/Program Files/mysql-advanced-5.6.14-win32
Datadir = D:/Program Files/mysql-advanced-5.6.14-win32/data
[Client]
# Set the client Character Set
Loose-default-character-set = utf8
[WinMySQLadmin]
Server = D:/Program Files/mysql-advanced-5.6.14-win32/bin/mysqld.exe
4. Open a command prompt, enter the D:/Program Files/mysql-advanced-5.6.14-win32/bin directory, and run the command: mysqld-install to install mysql to a windows service. After the execution is successful, the system prompts: Service successfully installed.
To uninstall the service, run mysqld-remove.
5. Execute: net start mysql at the command prompt to start mysql. stop the service and enter the command: net stop mysql. To set whether mysql is automatically started, enter service. msc in the Start Menu> running to open service management.
6. Enter:
C: \ Users \ Administrator> mysql-u root
Change Password:
Mysql> update mysql. user set password = PASSWORD ('root') where User = 'root'
Mysql> flush privileges
7. If an error is reported when mysql is started: A system error occurs and a system error occurs. 1067 the process is terminated unexpectedly.
Open the user name. err file under the D:/Program Files/mysql-advanced-5.6.14-win32/data directory, and the mysql error log is recorded in this file. We found this sentence in it:
110327 0:12:02 [ERROR] MySQL: unknown variable 'default-character-set = utf8'
It seems strange that it has been installed like this before. Finally, I found a Chinese DBA help information on the mysql official website. It turned out to be a bug in the new version and does not support setting the character set to utf8 directly in my. ini. Solution: Add loose-that is:
[Mysqld] # Set the character set to utf8
Loose-default-character-set = utf8
Basedir = D:/Program Files/mysql-advanced-5.6.14-win32
Datadir = D:/Program Files/mysql-advanced-5.6.14-win32/data
[Client]
# Set the client Character Set
Loose-default-character-set = utf8
[WinMySQLadmin]
Server = D:/Program Files/mysql-advanced-5.6.14-win32/bin/mysqld.exe
8. Although the preceding method is used to add loose-after mysql is started, no error is reported. However, garbled characters still occur during data insertion.
Mysql> show variables like '% char % ';
Run the preceding command to view the character set encoding. the following result is displayed:
+ -------------------------- + ----------------------------------------- +
| Variable_name | Value |
+ -------------------------- + ----------------------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | latin1 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | latin1 |
| Character_set_system | utf8 |
| Character_sets_dir | C :\ mysql-5.5.10-win32 \ share \ charsets \ |
+ -------------------------- + ----------------------------------------- +
It can be seen that character_set_database and character_set_server are still the default latin1 encoding. Modify the my. ini configuration file as follows:
[Mysqld]
# Set the character set to utf8
Loose-default-character-set = utf8
Character-set-server = utf8
Basedir = D:/Program Files/mysql-advanced-5.6.14-win32
Datadir = D:/Program Files/mysql-advanced-5.6.14-win32/data
[Client]
# Set the client Character Set
Loose-default-character-set = utf8
[WinMySQLadmin]
Server = D:/Program Files/mysql-advanced-5.6.14-win32/bin/mysqld.exe
Restart the service to go to mysql and check again:
+ -------------------------- + ----------------------------------------- +
| 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 | C :\ mysql-5.5.10-win32 \ share \ charsets \ |
+ -------------------------- + ----------------------------------------- +
OK