When win10 uses the zip package of mysql8.0.11 for configuration, there are many pitfalls in the tutorials found, and hereby summarizes the method of successful configuration.
1. Download the non-installed zip package
2. Unzip the zip package
Unzip the downloaded zip archive in the location to be installed, such as: D:\mysql, the files under it are as follows
3. Create my.ini file
Create a my.ini file in the mysql folder with the contents of
[mysqld]
# set basedir to your installation path
basedir=D:/mysql
# set datadir to the location of your data directory
datadir=D:/mysql/data
basedir is the path where mysql is installed, and datadir is the path where data is stored. During initialization, a data folder can be automatically created under the mysql folder. If there is no data folder, it will be created automatically. If there is, it must be ensured that there are no files under data, otherwise initialization error when
It should be noted here that the path must be written with slashes, such as: D:/mysql, or double backslashes when using backslashes, such as: D:\\mysql,D:\\mysql\\data , otherwise the initialization will report an error
4. Initialization
As an administrator, open the cmd command line, and in the installation path, execute the command bin/mysqld --initialize, such as: D:\mysql > bin/mysqld --initialize or D:\mysql\bin> mysqld --initialize initialization ,
If you want to run the mysqld command on any open cmd command line, you can configure the environment variable, and configure the path of mysqld to the environment variable area. Here, edit the path of D:\mysql\bin into the path.
5. Install install mysql service (default mysql service)
D:\mysql\bin>mysqld --install
6. Start the service
net start mysql//case insensitive
7. Stop the service
net stop mysql //or mysqladmin shutdown
The difference between the two initialization methods of mysqld --initialize and mysqld --initialize-insecure
a. When initializing with mysqld --initialize, after starting the service (net start mysql) and linking to the service (mysql -u root -p ), you need to enter a random password, which can be found in the data folder with the file ending in .err, open this file
Find the following statement similar to the following, iTag*AfrH5ej after localhost is the password
[Warning] A temporary password is generated for root@localhost:
iTag*AfrH5ej
b. When using mysqld --initialize-insecure to initialize, it is not necessary to enter a password. After starting the service, link to the service (mysql -u root --skip-password), you do not need to enter a password, and change the password after entering the link
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';