Download
Visit https://dev.mysql.com/downloads/mysql/Download mysql5.6
Unzip after download, see the following directory
Install start MySQL
1.添加环境变量【右键计算机】--》【属性】--》【高级系统设置】--》【高级】--》【环境变量】--》【在第二个内容框中找到 变量名为Path 的一行,双击】 --> 【将MySQL的bin目录路径追加到变值值中,用 ; 分割】
2.初始化mysqld --initialize-insecure3.启动MySQL服务mysqld # 启动MySQL服务4.启动MySQL客户端并连接MySQL服务mysql -u root -p # 连接MySQL服务器
Open a terminal output mysqld startup service, another terminal input MySQL access MySQL, interface mysql > instructions to start MySQL success
5. View MySQL Service
Takslist |findstr MySQL
Making a MySQL service into a Windows service
Note: Before--install, you must use the absolute path of the MySQL startup command # to make the MySQL Windows service, execute this command at the terminal: mysqld--install# Remove the MySQL Windows service, execute this command at the terminal: mysqld-- After remove is registered as a service, you will need to execute the following command only after you start and close the MySQL service: # start MySQL service net start mysql# shut down MySQL service net stop MySQL
Enter commands with Administrator cmd
Kill the MySQL process and start the service
Start and stop the MySQL service
Login Settings Password
C:\windows\system32>mysqlwelcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 1Server version:5.6.41 mysql Community Server (GPL) Copyright (c) #, 2018, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql>mysql>mysql> Select User (); # View user +----------------+| User () |+----------------+| [email protected] |+----------------+1 row in Set (0.00 sec) mysql> Exitbyec:\windows\system32>mysql-u root- P #使用root用户登录, the default password is null enter Password:welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.6.41 mysql Community Server (GPL) Copyright (c) #, 2018, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> Select User (); +----------------+| User () |+----------------+| [email protected] |+----------------+1 row in Set (0.00 sec) Mysql> Exitbyec:\windows\system32>mysqladmin-u Root-p password "123" #修改密码123Enter password:Warning:Using a password on the command line interface can be insecure. C:\windows\system32>mysql-u root-p #用密码123登录数据库Enter Password: ***welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.6.41 mysql Community Server (GPL) Copyright (c) #, 2018, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> exitbyec:\windows\system32>mysqladmin-U root-p123 Password "456" #修改密码为456Warning: Using a password on the command line interface can is insecure. c:\windows\system32>mysql-uroot-p456 #用密码456登录数据库Warning: Using a password on the command line interface can be insec Ure. Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 7Server version:5.6.41 mysql Community Server (GPL) Copyright (c) #, 2018, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> Select User (), +----------------+| User () |+----------------+| [email protected] |+----------------+1 row in Set (0.00 sec)
Crack password
#1 shutdown mysql#2 is executed in cmd: mysqld--skip-grant-tables#3 is executed in cmd: Mysql#4 performs the following sql:update Mysql.user set authentication_string= Password (") where user = ' root '; flush privileges; #5 Tskill mysqld #或taskkill-F/pid Process # # # restart MySQL
Stop the MySQL service, skip the authorization method to start
Modify the MySQL server root password
C:\users\>mysql-uroot-p #使用空密码登录Enter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.6.41 mysql Community Server (GPL) Copyright (c) #, 2018, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> Select User (); +--------+| User () |+--------+| [email protected] | +--------+1 row in Set (0.00 sec) mysql> Update mysql.user set Password=password ("111") where user= "root" and host= "Loca Lhost "; #修改密码Query OK, 1 row affected (0.01 sec) Rows matched:1 changed:1 warnings:0mysql> flush privileges; #刷新权限Query OK, 0 rows affected (0.03 sec) mysql> Exitbye
Restart MySQL server, log in with new password 111
Unified character encoding
Emphasis: Comments in the configuration file can have Chinese, but the configuration item cannot appear in Chinese
#在mysql的解压目录下, create a new My.ini, and then configure # #. The following configuration takes effect when the mysqld command is executed, that is, when the MySQL service is started [mysqld];skip-grant-tablesport=3306character_set_server= utf8default-storage-engine=innodbinnodb_file_per_table=1# extracted directory Basedir=c:\pythonstudy\mysql5.6#data directory datadir=c : \pythonstudy\mysql5.6\data\ #在mysqld--initialize, the initial data will be stored in the directory specified here, after initialization, when the start of MySQL, will go to this directory to find data #. For the global configuration of the client commands, the following configuration takes effect when the MySQL client command executes [client]port=3306default-character-set=utf8user=rootpassword=111#3. Only for MySQL this client configuration, 2 is the global configuration, and here is only for MySQL this command local configuration [MySQL];p Ort=3306;default-character-set=utf8user=egonpassword =4573
My.ini character encoding settings
#1. Modify configuration file [Mysqld]default-character-set=utf8 [Client]default-character-set=utf8 [mysql]default-character-set=utf8# mysql5.5 above: Modification method changed [Mysqld]character-set-server=utf8collation-server=utf8_general_ci[client] Default-character-set=utf8[mysql]default-character-set=utf8#2. Restart Service # #. View the results of the changes: \sshow variables like '%char% '
Windows MySQL default installation character
After modifying the MySQL characters, reboot to see the utf-8 characters of the new settings
Windows install MySQL