MySQL 5.7.17 compression version installation in Windows, mysql5.7.17
First download the latest MySQL 5.7.17 Community compressed version for Windows 64-bit:
Http://dev.mysql.com/downloads/mysql/
Decompress the package to the installation directory (for example, C: \ Prog \ MySQL \). Next copy the my-default.ini TO my. ini and modify my. ini as follows:
[mysql]default-character-set=utf8mb4[mysqld]basedir = C:\Prog\MySQLdatadir = C:\Prog\MySQL\dataport = 3306max_connections=200character-set-server=utf8mb4collation-server=utf8mb4_general_cidefault-storage-engine=INNODBjoin_buffer_size = 128Msort_buffer_size = 2Mread_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
Then, use "Administrator identity" to open cmd-"Administrator identity", which is very important. Go to the installation directory to install the MySQL service:
C:\Prog\MySQL\bin>mysqld installService successfully installed.
Then start the MySQL service:
net start mysql
At the beginning, I thought it was so simple, but the moth reported the following error:
If it is started through the "service" in Windows, the prompt is:
The problem was really difficult. After a long investigation, it turned out to be:
If you installed MySQL using the Noinstall package, you may need to initialize the data directory:
- Windows distributions prior to MySQL 5.7.7 include a data directory with a set of preinitialized accounts in the mysql database.
- As of 5.7.7, Windows installation operations stored med using the Noinstall package do not include a data directory. to initialize the data directory, use the instructions at Section 2.10.1.1, "Initializing the Data Directory Manually Using mysqld ".
For details, refer to the two links:
2.3.5.4 Initializing the Data Directory
2.10.1.1 Initializing the Data Directory Manually Using mysqld
The cause is found. Let's manually Initialize the Data Directory:
mysqld --defaults-file=C:\Prog\MySQL\my.ini --initialize-insecure
Then:
net start mysqlmysql -u root -p
Familiar mysql> should be out.
I hope to help people who encounter similar pitfalls. The reason is that the compressed package version 5.7.7 and later needs to be changed to manual Initialize Data Directory.
There is no such thing as skill.
My environment:
- Windows 10 64-bit
- MySQL Community Server 5.7.17 for Windows (x86, 64-bit), ZIP Archive
(Split line, MySQL 5.7.17 is installed .)
Finally, I tried SQLAlchemy to test MySQL:
"SQLAlchemy MySQL test" from sqlalchemy import create_engine, Table, Column, Integer, MetaDatafrom sqlalchemy. dialects. mysql import CHARfrom sqlalchemy. SQL import selectENGINE = create_engine ('mysql + pymysql: // root: @ FIG: 3306/test? Charset = utf8mb4 ') CONN = ENGINE. connect () USERINFO = Table ('userinfo', MetaData (), Column ('id', Integer, primary_key = True, autoincrement = True), Column ('name ', CHAR (24, charset = 'utf8mb4'), mysql_charset = 'utf8mb4') USER = select ([USERINFO]) RESULT = CONN.exe cute (USER) for row in RESULT: print (row. name) RESULT. close () CONN. close ()
The result shows that an alarm is triggered when the output result is returned:
Warning: (1366, "Incorrect string value: '\ xD6 \ xD0 \ xB9 \ xFA \ xB1 \ xEA...' for column 'variable _ value' at row 480 ")
What's going on? It should be okay to check all character set settings n times ......
What have you found in countless thoughts and experiments? What did you find? If show variables like '% charac %' is found, an alarm is triggered!
Let's take a look at this Warning:
Isn't it exactly it? MySQL Bug ?! OMG!
Okay! Back to MySQL 5.6.35!
The alarm is missing!
Then re-create the database, create tables, and test the program:
Now it's okay, and I finally made a round trip back to MySQL 5.6.35.
Writing Python quietly, No one is arguing, and it is not like tearing up the front-end. It's time and time, and Python is good.
Finally, I like Visual Studio Code:
Summary
The above is all about this article. I hope some of my experiences can help my friends who have encountered these problems. If you have any questions, you can leave a message.