Install and set mysql under win7

Source: Internet
Author: User
Tags mysql manual
1. Download free installation: 1) Size: 206 MB; 2) download link: dev.mysql.comgetDownloadsMySQL-5.6mysql-5.6.11-win32.zip installation: 1) Size: 170 MB; 2) download link: dev. mysql. comgetDownloadsMySQLInstallermysql-installer-community-5.6.11.0.

1. Download free installation version: 1) Size: 206 MB; 2) download link: http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.11-win32.zip installation version: 1) Size: 170 MB; 2) download link: http://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-5.6.11.0.


1. Download

Free installation version:
1) Size: 206 MB;
2) download link: http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.11-win32.zip
Installation version:
1) Size: 170 MB;
2) download link: http://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-5.6.11.0.msi
For more version downloads, visit: http://dev.mysql.com/downloads/

2. Installation

Manually set MySQL to load as a system service and set it to auto-start as follows:

1) Start Menu, Run "CMD" to enter the command line mode, and use "echo % WINDIR %" to view the Windows directory. The default value is "C: \ Windows ";
2) Create the my. ini file (MySQL configuration file, used to specify the character set of the client and server, data storage path, MySQL execution file path, and so on), and put it into the system's WINDIR

Directory, that is, the C: \ Windows \ directory. The content is as follows:

[Mysqld] # Set mysql installation directory basedir = C:/lamp/mysql-5.6.10-win32 # Set the mysql database data storage directory, must be data, or \ xxx \ datadatadir = C: /lamp/mysql-5.6.10-win32/data # set mysql Server character set character_set_server = utf8 # maximum number of connections allowed max_connections = 200 [client] # set mysql client character set default-character-set = gbk


3) enter the mysql decompression directory under the command line and install mysql as the system service. The specific command is as follows:

Cd C: \ lamp \ mysql *
Mysqld -- install

Run mysql.

Net start mysql

After the instance is started successfully, the following message is displayed:

MySQL service is starting.
The MySQL service has been started successfully.

The command to stop mysql is as follows:

Net stop mysql

3. Problem Solving

1) Error 1066
Most paths are incorrectly specified (the content in my. ini file is incorrectly set ). For example, you specify a new database directory (in this example, C:/lamp/mysql-

5.6.10-win32/data), but the files in the original database directory are not copied to the new directory. In addition, pay attention to whether your system is 32-bit or 64-bit. You need to download the corresponding version.
If this error occurs, we also know that the path is incorrect. Which path is the key? When MySQL is started, logs are recorded and stored in the data directory (in this example

C: \ lamp \ mysql-5.6.10-win32 \ data), the name generally starts with xp, err as the suffix, for example: XP-201112161633.err, we can open it through notepad. Due to log

Information is usually written in the form of append. To view the latest log Content, open the file and switch to the end of the file content. The following is an example of a file:

22:06:38 4648 [Note] Plugin 'federated 'is disabled.
22:06:38 4648 [Note] InnoDB: The InnoDB memory heap is disabled
22:06:38 4648 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
22:06:38 4648 [Note] InnoDB: Compressed tables use zlib 1.2.3
22:06:38 4648 [Note] InnoDB: CPU does not support crc32 instructions
22:06:38 4648 [Note] InnoDB: Initializing buffer pool, size = 128.0 M
22:06:39 4648 [Note] InnoDB: Completed initialization of buffer pool
22:06:39 4648 [Note] InnoDB: Highest supported file format is Barracuda.
22:06:39 4648 [Note] InnoDB: 128 rollback segment (s) are active.
22:06:39 4648 [Note] InnoDB: Waiting for purge to start
22:06:39 4648 [Note] InnoDB: 1.2.10 started; log sequence number 1626017
22:06:39 4648 [ERROR] MySQL: unknown variable 'default-character-set = utf8'
22:06:39 4648 [ERROR] Aborting

The [ERROR] section in the above section is the ERROR message, from which we can clearly know that the default-character-set variable is set incorrectly, open

C: \ windows \ my. ini file to "character_set_server = utf8 ". Enter "net start mysql" in the command line to solve the problem.

If the problem persists for a long time and fails, you can restart the instance, or shut down and restart the instance. :)

2) Other problems
To be added later.

4. Other settings and operations

1) view all running services
Enter services. msc in the command line to open the "service" Setting dialog box. You can use the mouse to start, stop, and view services through the menu;
2) delete a service
Enter the SC delete service name in the command line. For example, to delete the mysql service, enter SC delete mysql.
3) log on to MySQL through the command line

Cd \ lamp \ mysql * \ bin
Mysql-uroot-p

4) Client
Navicat

Http://blog.sina.com.cn/s/blog_c71dc34a0101dk20.html


There are two ways to start a MySQL Server: one is to start from a Windows command line, and the other is to start a Windows service.
Start the MySQL server from the Windows command line, start the console window, and enter the command:
D:/MySQL/bin> mysqld-nt
Stop the MySQL server from the Windows command line, start the console window, and enter the command:
D:/MySQL/bin> mysqladmin-u root shutdown
The path used varies depending on the MySQL installation location in the system.
After the server is started, the server runs on the front-end. No command prompt is displayed before the server exits. Therefore, when the server is running, you should open another console window to run the client program. The same is true if you stop the server.
Start the MySQL server as a Windows Service, install the MySQL service, start the console window, and enter the following command:
D:/MySQL/bin> mysqld-nt -- install-manual MySQL -- defaults-file = D:/MySQL/my. ini
-- Install option, which provides the default service name (MySQL). The -- install-manual option is used to set the service to manual start mode, if you want to start the service automatically, replace -- install-manual with -- install.
-- Defaults-file option. The server only reads the configuration from the [mysqld] Group of the specified file.
Run the net start MySQL command to START the service and the net stop MySQL command to STOP the service.
To uninstall the service, use the net stop MySQL command to STOP the service if the service is running.
Start the console window and enter the following command:
D:/MySQL/bin> mysqld-nt -- remove

5. Connect and disconnect MySQL
Start the console window and enter the following command:
D:/MySQL/bin> mysql-u root
Welcome to the MySQL monitor. Commands end with; or/g.
Your MySQL connection id is 2
Server version: 5.0.67-community-nt MySQL Community Edition (GPL)
Type 'help; 'or'/H' for help. type'/C' to clear the buffer.
Mysql> quit
Bye
D:/MySQL/bin>
By default, the password of the root user is blank. You only need to press enter once and use the quit command to disconnect MySQL.

6. Make the Default User Account secure
The initial root account password is blank, so anyone can use the root account to connect to the MySQL server without any password and have all permissions.
Mysql> select host, user, password from mysql. user;
+ ----------- + ------ + ---------- +
| Host | user | password |
+ ----------- + ------ + ---------- +
| Localhost | root |
| 127.0.0.1 | root |
| Localhost |
+ ----------- + ------ + ---------- +
If you do not want anonymous users to log on, You can delete them. We recommend that you delete them or set a password for them because the anonymous users have the same permissions as root users.
Mysql> drop user ''@ 'localhost ';
Use set password to specify the PASSWORD, use root to connect to the server, and execute two set password statements. You must use the PASSWORD () function to encrypt the PASSWORD.
Mysql> set password for 'root' @ 'localhost' = password ('root ');
Mysql> set password for 'root' @ '127. 0.0.1 '= password ('root ');
After the password is set, you must provide the corresponding password when you re-connect to the server next time.
D:/MySQL/bin> mysql-u root-p
Enter password :****


[Configure MySQL 5.6.13]

After installation, you must configure it before use, right.

1. parameter configuration of my. ini
For more complex parameter configurations in my. ini, I will not introduce them here. To optimize MySQL, you can refer to the MySQL manual on the official website.

2. configure root user logon
By default, the root is empty password, so run d: \ mysql-5.6.13 \ bin \ mysql-uroot-p directly, prompt to enter the password, directly press enter to enter the root identity to enter the management MySQL.
It is so horrible that the root user does not have a password. Let's set a password for it. Run d: \ mysql-5.6.13 \ bin \ mysqladmin-uroot-p password <新密码> , Set <新密码> Replace it with your custom password and press Enter. The system will prompt you to enter the password, which actually refers to the original password. Because the original password is empty, you can press enter to complete the settings.

3. Other operations

After logging in with the root user and his new password, you can complete all other operations.


Http://blog.csdn.net/red4711/article/details/6007248

Http://blog.csdn.net/zhuoxiong/article/details/7453773



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.