MySQL large memory configuration scheme such as my-medium.ini, my-huge.ini, myhuge. ini

Source: Internet
Author: User
Tags mysql login

MySQL large memory configuration scheme such as my-medium.ini, my-huge.ini, myhuge. ini

MySql noinstall-5.1.xx-win32 configuration (original)

1. Decompress mysql-noinstall-5.1.xx-win32.zip to your favorite directory, for example, d: \ php \ mysql.

2. There are five configuration files in the root directory d: \ php \ mysql:

My-small.ini (memory <= 64 M)
My-medium.ini (memory 128 M)
My-large.ini (memory 512 M)
My-huge.ini (memory 1 GB-2 GB)
My-innodb-heavy-4G.ini (memory 4 GB)

Suppose my memory is 1 GB, I chose a my-huge.ini, choose one of them is suitable for your own machine sub-configuration file.

3. edit my. ini and add the following two sentences under "port = 3306" of [mysqld:

Note: In Windows, use the slash "/" instead of the Backslash "\" in the path name. If you use the Backslash "\", you must double-write them "\".

# Installation directory path # Set the data storage directory of the mysql database, which must be data or \ xxx \ data

Basedir = "E:/by8/MySQL /"

# Set the directory for storing mysql database data
Datadir = "F:/by8/MySQL/Data /"

# Set the character set of the mysql server
Default-character-set = utf8

# Default storage engine
Default-storage-engine = MYISAM

Move the "E: \ by8 \ mysql \ data" directory to "F: \ by8 \ MySQL \ Data ".

Add the following in [mysql:
Default-character-set = utf8

Modify the following statements:
Max_allowed_packet = 32 M (1 M by default)
Sort_buffer_size = 4 M (MySQL 5.0.15 my-medium.ini is 512 K by default)

Max_allowed_packet parameter description:
The parameter is used to control the maximum length of its communication buffer.

Sort_buffer_size parameter description:
The buffer size that can be used to query sorting.
Note: The allocated memory corresponding to this parameter is exclusive to each connection!
If there are 100 connections, the total size of the actually allocated sort buffer is 100 × 6 = 600 MB.
Therefore, we recommend that you set the size of a server with around 4 GB to 6-8 Mb.

4. Install the service:
"E: \ by8 \ mysql \ bin \ mysqld" -- install Mysql -- defaults-file = "E: \ by8 \ Mysql \ my. ini"

5. Start the service:
Net start mysql

In this way, mysql is installed. In the task manager, you can see the process mysqld-nt.exe. It indicates that your mysql has been installed. And started successfully.

6. Set a password for anonymous users:

% Myd_dir % \ bin \ mysqladmin.exe-uroot-ptoor password "% my_newpwd %"

The mysql login password that was just installed is a blank password:

C: \ Documents ents and Settings \ Administrator> e:
E: \> cd by8
E: \ by8> cd mysql
E: \ by8 \ Mysql> cd bin
E: \ by8 \ Mysql \ bin \> mysql-uroot-p
Enter password: // press enter here. You do not need to Enter the password.
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
+ -------------------- +
3 rows in set (0.00 sec)

To ensure security, modify the password of the root user of the newly installed mysql database. The command is as follows:

Mysql> use mysql
Database changed
Mysql> update user set password = password ("123456") where user = "root ";
Query OK, 2 rows affected (0.03 sec)
Rows matched: 2 Changed: 2 Warnings: 0

Mysql> exit // exit

In this case, I changed the root password to 123456.

You can also use the msyqladmin command to change the password.
Are you sure you can log on to us and exit mysql?
Format: mysqladmin-u username-p old password New password
> Exit
> Mysqladmin-uroot-password 123456
// Here, we change the original empty password of mysql root to 123456. Because the original root has no password,-p can omit the password.
To impress everyone, we will change the modified password 1234560 to 123456 again.
Command: mysqladmin-uroot-p123456 password 1234

PS: two tables for MYSQL to record the user name and password are:

User. MYD and user. MYI. Back up them and there will be no need to change the password for reinstallation.


MYSQL-optimized configuration MYINI

Buy a mysql optimization book and check it out. There are also optimization documents on the Internet.

How to Create a myini file in the Mysql folder

Under the mysql \ MySQL Server 5.0 folder installed
My-small.ini, my-large.ini, my-huge.ini, etc, according to their own database busy program, choose a copy into my. ini, you do not know which one to use,
Just copy a copy of The my-medium.ini and rename it my. ini ..

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.