[MySQL] install the decompressed MySQL version in Windows

Source: Internet
Author: User

Statement:This unzipped version is a 100 multi-M mysql-5.5.xx-Win32. ZIP file, not dozens of MB,Mysql-5.5.xx.zipFile, hereby declare... ^ V ^

I take mysql-5.5.10-win32.zip as an example, the decompression path is c: \ mysql-5.5.10-win32.

OK, go to the topic...

Official download mysql-5.5.10-win32.zip, 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 the client Character Set
Default-character-set = utf8

[Winmysqladmin]
Server = C:/mysql-5.5.10-win32/bin/mysqld.exe

Open a command prompt, enter the % mysql_home %/bin directory, and execute the command: Mysqld-installInstall MySQL to a 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 the following command: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:
PropertiesCode

[Mysqld]
# Set the character set to utf8
Loose-default-character-set = utf8

[Client]
# Set the client Character Set
Loose-default-character-set = utf8

 

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 under [mysqld] configuration optionsCharacter-set-Server = utf8, 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 \ |
+ -------------------------- + ----------------------------------------- +

Perfect solution

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.