1. Preparations
Download mysql's latest free installation unzip mysql-noinstall-5.1.53-win32.zip, decompress to the relevant directory, such as: d: \ mysql-noinstall-5.1.53-win32. This is the root directory of mysql.
2. Configuration
There are several files in the root directory:
My-small.ini (this is for a small memory (<= 64 MB) system, MySQL will only be used from time to time, it is important that the mysqld daemon will not use a lot of resources .)
My-medium.ini (which is targeted at a small memory (32 M-64 M) system, MySQL plays a more important part, or when the system reaches 128 MB, MySQL is used with other programs (such as a Web server .)
My-large.ini (this is for a large system with memory = 512 M and the system mainly runs MySQL)
My-huge.ini (this is for a large system with 1G-2G memory, the system mainly runs MySQL)
My-innodb-heavy-4G.ini (this is an example of a MySQL configuration file for a 4G memory system (mainly running MySQL with only InnoDB tables and performing complex queries using several connections)
Corresponding to your own configuration, select the appropriate one, and delete the other one. Rename it to my. ini. Edit my. ini and add the following statements under the [mysqld] node:
Basedir = D:/mysql-noinstall-5.1.53-win32 # root directory
Datadir = D:/mysql-noinstall-5.1.53-win32/data # data file storage directory
3. Install the service
Cmd: Enter the mysql root directory \ bin:
Mysqld -- install MySQL
In this way, a windows service is added with the default MySQL name. To remove the mysql service:
Mysqld-remove MySQL
Set the service to auto start:
SC config MySQL start = auto
4. Start and close
Copy codeThe Code is as follows:
Cmd:
Net start MySQL -- start
Net stop MySQL -- disable
After mysql is started. In the task manager, you can see the process mysqld.exe. It indicates that mysql has been installed. Started successfully!
5. Simplified:
If you think the mysql directory is too large, see. Only the my. ini and bin, data, and share directories can be left in the root directory, and all others can be deleted. You can delete all. pdb files in the bin directory.
6. initialize the database:
Because the default mysql root Password is empty and can only be logged on from the local machine, make the following changes:
Cmd: Enter the mysql root directory \ bin:
Mysql-uroot
In this case, enter the mysql command line interface and continue to enter:
Copy codeThe Code is as follows:
Mysql <use mysql;
Mysql <delete from user;
Mysql <grant all on *. * to root @ '%' identified by "root" with grant option;
Mysql <flush privileges;
Mysql <quit;
In this way, the initial password "root" is assigned to the root user, and local logon is not restricted.
7. garbled problem:
Modify the my. ini file, find [mysqld], and add:
Copy codeThe Code is as follows:
Character-set-server = utf8 # Start With mysql5.5
Default-character-set = utf8 # Before mysql5.5
Find the [client] and add the following:
Copy codeThe Code is as follows:
Default-character-set = utf8
For the installation steps and configuration files provided by another user, refer to the two methods
1. decompress the downloaded noinstall package to the location you want to place, and you can keep it there after you put it! It doesn't matter if you reinstall the system in the future. Here I am: E:/Program Files/mysql-5.1.58-win32/
2. Create a New my. ini file. This is the mysql configuration file and can be renamed from the original ini, but now you can directly copy the following Configuration:
Copy codeThe Code is as follows:
[Client]
Port = 3306
[Mysql]
Default-character-set = gbk
[Mysqld]
Port = 3306
Basedir = "E:/programs Files/mysql-5.1.58-win32 /"
Datadir = "E:/MySQL Datafiles /"
Default-character-set = gbk
Default-storage-engine = INNODB
SQL-mode = "STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION"
Max_connections = 100
Query_cache_size = 15 M
Table_cache = 256
Tmp_table_size = 18 M
Thread_cache_size = 8
Myisam_max_sort_file_size = 100G
Myisam_sort_buffer_size = 35 M
Key_buffer_size = 23 M
Read_buffer_size = 64 K
Read_rnd_buffer_size = 256 K
Sort_buffer_size = 256 K
Innodb_data_home_dir = "E:/MySQL Datafiles /"
Innodb_additional_mem_pool_size = 2 M
Innodb_flush_log_at_trx_commit = 1
Innodb_log_buffer_size = 1 M
Innodb_buffer_pool_size = 42 M
Innodb_log_file_size = 10 M
Innodb_thread_concurrency = 8
Note: The datadir and innodb_data_home_dir values need to be modified here. I have always set them to the same folder. Innodb_data_home_dir is the data address of the INNODB database storage engine.
3. Run cmd to enter the bin directory under the mysql installation directory, and then execute:
Mysqld -- install mysql -- defaults-file = "E: \ Program Files \ mysql-5.1.58-win32 \ my. ini"
Is registered as a system service. The following default configuration file is the path of the file created in the previous step.
-- Install is followed by the service name
The following error occurs: Service successfully installed. The Service is successfully registered.
4. Then:
Net start mysql
Start the newly registered mysql service.
OK. If you want to delete this service.
Use:
Mysqld -- remove
This command deletes the mysql service by default. If it is not the name, add the corresponding service name after removing the service.