This article mainly introduces the mysql5.xzip directly decompress the version of the installation method, you can refer to the need to download mysql-5.5.10-win32.zip to the official network, and then extract mysql to any path, such as: C: \ mysql-5.5.10-win32
Open Computer-> Properties-> Advanced System Settings-> environment variables, create a new environment variable named: MYSQL_HOME, variable value for your mysql root directory, such as: C: \ mysql-5.5.10-win32
Then add:; % MYSQL_HOME % \ bin to the system variable Path.
Under the root directory there are a few INI files that have been written at the beginning of "my-", choose a suitable for you, such as: my-small.ini. Copy one copy, change the file name to my. ini, and add the following content:
[Mysqld] # set the character set to utf8 default-character-set = utf8 basedir = C:/mysql-5.5.10-win32 datadir = C: /mysql-5.5.10-win32/data [client] # set client character set default-character-set = utf8 [WinMySQLadmin] Server = C:/mysql-5.5.10-win32/bin/mysqld.exe
Open the command prompt, enter the % MYSQL_HOME %/bin directory, and run the command: mysqld-install to install mysql to the windows service. After the execution is successful, the prompt is: C: \ mysql-5.5.10-win32 \ bin> Service successfully installed.
To uninstall the service, run mysqld-remove.
Then run: net start mysql at the command prompt to start mysql. to stop the service, 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.
Enter:
C: \ Users \ Administrator> mysql-u root
Change password:
Mysql> update mysql. user set password = PASSWORD ('root') where User = 'root'
Mysql> flush privileges
However, I still encountered a small problem during the installation process, and an error was reported when mysql was started:
System error.
System error 1067 occurs.
The process stops unexpectedly.
Open the username. err file in the % MYSQL_HOME %/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 [client] # set the client character set loose-default-character-set = utf8
No error is reported when the instance is started... Original address of the help information:
Http://forums.mysql.com/read.php? 237318
Postscript:
Although the preceding method is used to add loose-, mysql does not return an error when it is started. However, garbled characters still occur during data insertion, causing a lot of trouble for me.
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.
Add character-set-server = utf8 under the [mysqld] configuration option, restart the service to enter mysql and view it 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 \ |
+ -------------------------- + ----------------------------------------- +
Perfect solution