Python Day10 MySQL 01

Source: Internet
Author: User

MySQL Database Basic Management window version installation

1. Download: MySQL Community Server 5.7.16
http://dev.mysql.com/downloads/mysql/

2. Decompression
If you want MySQL to be installed in the specified directory, then move the extracted folder to the specified directory, such as: C:\mysql-5.7.16-winx64

3. Add Environment variables
"Right-click Computer"-"Properties"-"Advanced system Settings"-"Advanced"-"Environment variable"-"in the second content box to find the variable named path of a row, double-click"-"the MySQL Bin directory path appended to the variable value, with;

4. Initialization
Mysqld--initialize-insecure

5. Register as a system service
Note: The absolute path of the command must be started with MySQL before--install
To make a Windows service for MySQL, execute this command at the terminal:
"C:\mysql-5.7.16-winx64\bin\mysqld"--install

To remove the MySQL Windows service, execute this command at the terminal:
"C:\mysql-5.7.16-winx64\bin\mysqld"--remove

#5.6 can be directly mysqld--install MySQL56
After registering, you can view it directly from the Windows service.

After registering as a service, you only need to execute the following command when you start and close the MySQL service later:
Start the MySQL service
net start MySQL

Turn off MySQL service
net stop MySQL

6. Start the MySQL client and connect to the MySQL service
Mysql-u root-p # Connect to MySQL server

Reset Password

net stop MySQL
Mysqld--skip-grant-tables #跳过授权表
Mysql-uroot-p
Update Mysql.user Set Password=password ("") where user= ' root ' and host= ' localhost ';
Flush privileges;

Unified character encoding configuration file

Under MySQL's decompression directory, create a new My.ini, and then configure

    1. The following configuration takes effect when the mysqld command is executed, that is, when the MySQL service starts
      [Mysqld]
      ; skip-grant-tables
      port=3306
      Character_set_server=utf8
      Default-storage-engine=innodb
      Innodb_file_per_table=1

#解压的目录
Basedir=e:\mysql-5.7.19-winx64
#data目录
Datadir=e:\my_data #在mysqld--initialize, the initial data is stored in the directory specified here, and after initialization, when MySQL is started, it will go to this directory for data

    1. For global configuration of client commands, the following configuration takes effect when the MySQL client command executes
      [Client]
      port=3306
      Default-character-set=utf8
      User=root
      Password=123

    2. 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
      ;d Efault-character-set=utf8
      User=egon
      password=4573

!!! If there is no [MySQL], the user's configuration when executing the MySQL command is based on [client]

Unified character encoding

#1. Modifying a configuration file

[mysqld]default-character-set=utf8[client]default-character-set=utf8[mysql]default-character-set=utf8

#mysql5. More than 5: 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
#3. To view the results of the modification:

\sshow variables like ‘%char%‘

Python Day10 MySQL 01

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.