Install, configure, and set the encoding format for mysql 5.6.20.

Source: Internet
Author: User

Install, configure, and set the encoding format for mysql 5.6.20.

I,Install

Installation environment

System: Window 32

Version: Mysql 5.6.20

1,First download Mysql 5.6.20 Win32 version from the official website http://dev.mysql.com/downloads/mysql/

2,We open the downloaded mysql-5.6.20-win32.msi installation package

3,Select Next:

4,Select "agree" and click "Next:

5,Custom installation (Custom), select Next:

6,Change the installation path and click Next:

7,Select Install)

8,Complete installation

 

II,Configuration

Note: services cannot be started or logged on after the version is installed. You need to manually configure

1,Run the command Cmd To Go To The mysql installation directory. The installation directory above is F: \ Develop install \ mysql \ bin, which can be opened using cd F: \ Develop install \ mysql \ bin.

2,Use mysqld to register mysql as a service and run the command mysqld-install Mysql.

3,Start Service: net start mysql

4,Log on to mysql. Because the default password of the root user is blank, press enter to enter mysql-u root-p.

5,SET the root PASSWORD to set password for 'root' @ 'localhost' = PASSWORD ('123 ');

Localhost indicates local connection, and password indicates password.

6,Configure several different Permissions

Add a user account that can be remotely logged on and set a password of 123456 to access all databases. If the user cannot remotely access the account, disable the firewall or add inbound and outbound rules, and add Port 3306.

GRANT all privileges on *. * TO 'bfdx '@' % 'identified by '000000' with grant option; flush privileges;

Mysql adds user1 and authorizes access to the specified database db123, and sets the password 333333

Grant all privileges on db123. * to 'bfdx '@' % 'identified by '000000' with grant option; flush privileges;

Mysql adds user2, authorizes access to the specified database db123, sets the password 666666, and limits logon to the specified IP address segment.

Grant all privileges on db123. * to 'bfdx '@ '192. 168.4.41%' identified by '000000' with grant option; flush privileges;

7,For example, if the user name is bfdx and the password is 123456, all ip addresses are allowed to access

When mysql-u bfdx-p is used, the following error message is displayed:

Run: use mysql; delete from user where user = ''; flush privileges; to delete anonymous users.

Execute the logon statement mysql-u bfdx-p:

 

Note: After mysql is installed, Chinese characters are not supported by default. You need to manually set the encoding.

1,Find the mysql installation directory my. ini file, mysql 5.6.20 after installation without my. ini file, only my-default.ini file, still can start.

2,Rename A my-default.ini backup to my. ini.

3,Use the command to log on to mysql and enter show variables like 'character _ set _ %'

We can see that the names of each run are not uniform. We only need to convert character-set-server, character-set-client, character-set-database, character-set-results is changed to uniform encoding to support Chinese characters.

5,Change to gbk encoding, open the file my. ini, and add the following data to the file:

[Client]

Default-character-set = gbk

[Mysqld]

Character-set-server = gbk

[Mysql]

Default-character-set = gbk

6,After saving, restart the mysql service.

7,Run the command again and change it to gbk.

Note: As shown above, character-set-client = gbk is used by default and no changes have been made. If there are other codes, it is also a unified code to access the client. Open the data folder in the mysql installation directory and find the database you created. For example, test. Open the test file and find db. opt. open the file and change it to default-character-set = gbk.

Default-collation = gbk_chinese_ci

If you want to set it to utf8 encoding, modify it as follows:

Default-character-set = utf8 // character set

Default-collation = utf8_chinese_ci // sorting rule

8,You can create data and tables in the Command window and insert data for testing.


I have a mysql-5520-win32msi but do not know how to install and configure the inside of the thing, Grand chivalrous people can not give me detailed installation and configuration process, urgent

Mysql For Windows Installation Diagram

Demo installation: mysql-5.5.20-win32.msi (currently the latest version of mysql for windows)
Installation environment: Windows Server 2003 SP2 32-bit
Double-click the installation file, as shown in;

Next step;

Select accept agreement and click Next;

Three installation modes: Typical (Typical installation), Custom (Custom installation), and Complete (full installation)
Select Custom and then click Next;

In this step, select the Mysql installation directory and Data directory;
To ensure that the database Data remains unaffected after the system disk is redone due to system crashes or other unexpected situations, the Data directory must be installed on a non-system disk. The program Directory should also be installed on a non-system disk;
Select twice here. Select MySQL Server for the first time, select the Location on a non-system disk, and then copy the installation directory;

Select Server data files for the second time, select the Location on a non-system disk, and paste the copied program installation directory directly;
Check whether all the installation options are on a non-system disk;
Next step;

Click Install;

Start installation;

The following page is displayed during installation. Next step;

Select "Configure Mysql directly" and click "finish;

Start mysql configuration and click Next;

Detailed Configuration (Detailed Configuration) and Standard Configuration (Standard Configuration)
Select Detailed Configuration and click Next;

Select Server Machine (Server mode) and click Next;

Select Multifunctional Database (multi-function Database mode) and click Next;

Direct next step;

Select Manual Setting (manually set the number of connections) and enter the maximum number of connections allowed. Increase the value to 2000;

Select both options and then click Next;
3306 is the default port number of Mysql;

Set the encoding format here, select the bottom manual setting, and then select utf8 encoding;
(Two commonly used UTF-8 and gbk encoding methods are briefly introduced:
GBK contains all Chinese characters. It is a national code and is less universal than UTF8. For a website or forum, if there are many English characters, it is recommended to use UTF-8 to save space. However, many Forum plug-ins generally only support GBK.
UTF-8 contains all the characters needed by all countries in the world, is an international code, universal. UTF-8-encoded text can be displayed on browsers that support UTF8 character sets in countries. For example, if it is UTF-8 encoded, Chinese characters can also be displayed on Internet Explorer of foreigners. They do not need to download the Chinese language support package for Internet Explorer .)

Select the following option to allow the Windows command line to directly manage the database, and then click Next;

Enter the root management password. The following options allow the root user to access the database from the remote host as needed;

Click execute;

Mysql starts to execute the configuration. The installation is complete after the blue check mark is displayed for all the following four items;

After the installation is complete, you can directly manage Mysql on the Windows command line;
For example, view the Mysql version.
Enter mysql-V and press Enter. (Note: V is capitalized)
The currently installed Mysql version is 5.5.20 for Win32 (X86)

Log on to the Mysql database;
Input: mysql-u [username]-p
Press enter and enter the password to enter Mysql;

For example, if you use root to log on to Mysql, enter Mysql-uroot-p (-u and username can be separated by spaces or not)
Press enter, enter the password, and then press Enter;
You can see that the prompt is changed to mysql>, proving that you have entered mysql

Change the mysql user password:
Mysqladmin-u [username]-p [password] ...... the remaining full text>

During mysql installation, I chose latin1 as the encoding language type. Now, when writing data to the database, the man cannot write the data.

Find the installation path of mysql, which should be my. ini configuration file, open it, and change default-character-set = latin1 in 2 to default-character-set = utf8, and then shut down and restart it;

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.