"High availability MySQL" 1–windows environment compressed version of MySQL installation

Source: Internet
Author: User
Tags anonymous benchmark mysql manual

Recently in Reading O ' Reiliy series of"High availability MySQL", it is natural that the master-slave (master-slave) configuration and scale-out related content.

Master-slave this thing. It is standard in many companies. In the development of the basic daily use. There are also a lot of problems (such as Master never sync, master down). However, the operating permissions are limited. Some things, just have their own look, do, talent really know what the principle is, but also the ability to grasp better.

This article is the first reading note for high-availability MySQL, which mainly records the installation process of the compressed version of MySQLin the Windows environment (which is no longer mentioned in the installation-based idiot installation process).

1. Download the compressed version of MySQL from the official website

is: http://www.mysql.com/downloads/

Now that Oracle takes over MySQL, it seems that all resources need to have Oracle's account ability to download, and for those who are accustomed to click-to-download, they are not used to it.

The file I downloaded is:mysql-advanced-5.6.21-win32.zip

This version number of MySQL after decompression is very large, about 1.6G, the impression of the previous installation of the MySQL 5.1 version number of files + database files of several projects, but also just 700M

The folder after decompression contains approximately the following sub-folders:

Of

Bin folder -a variety of running programs that primarily contain MySQL

Data folder -file and index files that hold the database

Mysql-test -There are a lot of well-written test scripts

sql-bench -script for MySQL benchmark benchmark test

Bin, data, include, LIB, scripts folders, etc. are important for MySQL's normal execution, if not necessary. Don't move things in these folders.

About the selection of unzip folder:

Very many people like to unzip MySQL into the Program Files folder, which I do not recommend. The reason is that the Program Files folder itself has spaces, and in many cases it can fail. For example, some programs may think of a space as the end of a folder. The recommended decompression folder is: d:/mysql/in this form, or in other folders, such as D:/lamp/mysql, where to place, it is not important.

2. Configure Environment Variables

Open the System environment variable, append under the PATH variable (note that append is not overwritten) the MySQL Bin folder:

  

The blue section should be the full path to your Bin folder. Once configured, save and close the system variables form to do so.

3. Configure the MySQL configuration file My.ini

The normal installation version of MySQL will generate 4 different configuration ini profiles in the root folder of MySQL:

My-small.ini

My-medium.ini

My-large.ini

My-huge.ini

These configuration files are roughly the default configuration given by the size of the database. Be able to copy and generate the actual My.ini configuration file according to your own situation. Some version numbers also generate a InnoDB-only configuration file. Don't repeat it here.

After this compressed version of MySQL decompression, there is only one default profile in the root folder:My-default.ini. And when turned on, the configuration options are extremely simple:

In addition, there is no other (Khan).

Our configuration begins with this:

(1). Configure Basedir

Basedir refers to the root folder of MYSQL, so it should be: Basedir = D:\MYSQL

(2). Configure Data

The Data folder is the folder that holds the files and indexes. You can specify folders other than the MySQL folder as storage folders, but be aware of permissions issues.

My configuration is: DataDir = D:\MYSQL\data

(3). Configure Port

The general MySQL service uses 3306port, assuming the port is accounted for, can replace the other port

(4). Many other configurations

Set the client mode character: Default-character-set=utf8, on this issue, there will be a post devoted to it.

Table default storage citation: Default-storage-engine=innodb. Here by the way, MySQL older distribution, the default storage engine is MyISAM, the newer version number is the default InnoDB storage engine (detailed which version number, I also do not remember: D, can be seen through the changelog know)

For many other configurations, check out the MySQL manual.

4. Install the MySQL service and start

Execute mysqld–install MySQL in the bin folder of MySQL (please remember to execute cmd as Administrator)

Start MySQL service: net start MySQL(or right-click on the service->mysql, right-click Computer)

5. Change the MySQL user account

At this point, you should be able to connect to MySQL via command line under CMD.

After MySQL is installed by default, the root user and an anonymous user are generated, it is recommended to change the root account password and delete the anonymous user, such as the following:

  Use test; Select Host,userfromuser;

(1) To delete an anonymous user :

 Delete  from User where User =";

(2) To change the root account password:

Update User Set Password=Password ('123456whereUser=' root ';

(3) join MySQL remote connection permissions

Grant  All Privileges  on *. *  to [Email protected] ' % '  by ' 123456 ';

(4) Refresh Permissions

privileges;

The user table is a built-in table for MySQL that records user permissions, password, and more.

The primary key for this table is Host+user, which can be seen by the show Index command:

_priv the end of the field is the MySQL operation permission of the corresponding account, Filed-type is an enum

So far. MySQL configuration is basically complete. You might continue to post MySQL master-slave configuration. The highly available MySQL journey starts here.

"High availability MySQL" 1–windows environment compressed version of MySQL installation

Related Article

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.