1. Preparatory work
Download MySQL's latest installation-free version mysql-noinstall-5.1.53-win32.zip, extract to related directories, such as: d:\\ Mysql-noinstall-5.1.53-win32. This is the root directory of MySQL.
2. Configure
There are several files under the root directory as follows:
My-small.ini (This is for a small memory (〈= 64MB) system, MySQL will only be used from time to time, it is important that the mysqld daemon does not use a lot of resources. )
My-medium.ini (This is for a small memory (32m-64m) system, MySQL plays a more important part, or when the system reaches 128M, MySQL is used with other programs (such as a WEB server). )
My-large.ini (This is for a large system of memory = 512M, the system mainly runs MySQL)
My-huge.ini (This is for a large system of memory for 1G–2G, the system mainly runs MySQL)
My-innodb-heavy-4g.ini (This is an example of a MySQL configuration file for a 4G memory system (primarily running MySQL with only innodb tables and performing complex queries with several connections)
corresponding to their own configuration, the choice of their own, the other delete it. Then rename into My.ini. Edit My.ini and add the following sentences under the [Mysqld] node:
basedir= D:/mysql-noinstall-5.1.53-win32 #根目录
datadir= D:/mysql-noinstall-5.1.53-win32/data #数据文件存放目录
3. Installation Services
CMD: go to MySQL root directory \ Bin:
Mysqld--install MySQL
This adds a Windows service for the name with the default MySQL. To remove the MySQL service:
Mysqld–remove MySQL
To set up a service to start automatically:
sc config MySQL start= auto
4. Startup and shutdown
Copy Code code as follows:
Cmd:
net start MySQL-start
net stop MySQL--close
After MySQL starts. You can see mysqld.exe this process in Task Manager. This means that MySQL is already installed. and has been successfully launched!
5. Streamlining:
If you think the MySQL directory is too large, please look. The root directory can leave only the My.ini and Bin,data,share directories, and all the rest is deleted. The bin directory allows you to delete all of the. pdb files.
6. Initializing the database:
Because the MySQL default root password is empty and can only log on to the computer, make the following modifications:
CMD: go to MySQL root directory \ Bin:
Mysql-uroot
At this time entered the MySQL command line interface, continue to enter:
Copy Code code 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;
This gives the root user the initial password "root" and can not restrict the native login.
7. Garbled problem:
Modify the My.ini file, locate [mysqld], and add the following:
Copy Code code as follows:
Character-set-server = UTF8 #mysql5.5 Start
Default-character-set = UTF8 #mysql5.5 ago
Find [client] and add below:
Copy Code code as follows:
Default-character-set = UTF8
Another user to provide the installation steps and configuration files, you can refer to two ways
1. The download of the good Noinstall package to the location you want to put, this position can always put it! It doesn't matter to reload the system later. I am here: E:/program files/mysql-5.1.58-win32/
2. Create a new My.ini file. This is the MySQL configuration file, can also be renamed from the original INI, but now you can directly copy the following configuration:
Copy Code code as follows:
[Client]
port=3306
[MySQL]
Default-character-set=gbk
[Mysqld]
port=3306
Basedir= "E:/program 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=15m
table_cache=256
tmp_table_size=18m
Thread_cache_size=8
myisam_max_sort_file_size=100g
myisam_sort_buffer_size=35m
key_buffer_size=23m
read_buffer_size=64k
read_rnd_buffer_size=256k
sort_buffer_size=256k
Innodb_data_home_dir= "E:/mysql datafiles/"
Innodb_additional_mem_pool_size=2m
Innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1m
innodb_buffer_pool_size=42m
innodb_log_file_size=10m
Innodb_thread_concurrency=8
Note: Here you need to change the values of DataDir and Innodb_data_home_dir, I have been set to the same folder. Innodb_data_home_dir is the data address of the INNODB database storage engine.
3. Use 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 to register as a system service. The default configuration file that follows is the path to the file that was created in the previous step.
--install is followed by the service name.
Appear: Service successfully installed. The service registration is successful.
4. Then:
net start MySQL
Start the MySQL service just registered.
It's OK. If you want to delete this service.
Just use:
Mysqld--remove
This command is the default to delete the service named MySQL, if not the name, the Remove and then add the corresponding service name.