win10 download and install mysql8.0 version

  1. Open the official website to download: https://dev.mysql.com/downloads/mysql/
    insert image description here
    insert image description here
  2. After the download is complete, unzip it, here I put it directly on the C drive
    insert image description here
  3. Then open the mysql directory folder and create a new my.ini file. The content of the my.ini file is as follows. You need to modify two places, where datadir=your own mysql installation directory, datadir=your own mysql database data storage directory.
    ![Insert picture description here](https://img-blog.csdnimg.cn/9d8417a65c5244d2b285a489c41b1230.png
[mysqld]

#设置端口3306(mysql的默认端口为3306)
port=3306
#设置mysql的安装目录
basedir=C:\mysql-8.0.33-winx64
#设置mysql数据库的数据的存放目录
datadir=C:\mysql-8.0.33-winx64\data
#允许最大连接数
max_connections=200
#允许连接失败的次数。
max_connect_errors=10
#设置mysql服务器使用的字符集,默认为UTF8MB4
character-set-server=UTF8MB4
#创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
[mysql]
#设置mysql客户端默认字符集
default-character-set=utf8
[client]
#设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8
  1. Open the cmd command with administrator privileges, and then cd to the bin folder of the mysql directory. If it is not in the C drive, it is difficult to use the cd command directly. You need to enter the disk name plus a colon, such as, D: and then use the cd command
    insert image description here
  2. Enter mysqld --initialize --user=mysql --console in the cmd command box
    . This is a key operation step. A temporary password will be generated during the initialization process, which needs to be remembered and used for login later. Note: the temporary password does not contain spaces, and remove the spaces when copying
mysqld --initialize --user=mysql --console

insert image description here
6. Continue to enter mysqld -install
mysqld This is the name of the Windows service, which can be customized, but cannot be repeated. If it prompts Install/Remove of the Service Denied!, it is caused by not opening cmd as an administrator. Find cmd and right click to Just run it as an administrator
insert image description here
7. Enter net start MySQL to start the service

net start MySQL

insert image description here
8. Enter mysql -u root -p in the cmd window to start logging in to use mysql, a password input interface will appear here, here enter the temporary password generated by installing mysql in step 4 above.

mysql -u root -p

After mysql8.0 version, you need to use a temporary password for the first login, and you need to change the password after login to use it. Enter
ALTER USER root@localhost IDENTIFIED BY 'mysql password you need to set';
remember to add a semicolon at the end, which is not needed here flush privileges; it is only necessary to refresh the privileges and change the password, and it is not necessary to change the password for the first login.

//修改密码
ALTER USER root@localhost IDENTIFIED BY '你自己需要设置的mysql密码';
//刷新权限
flush privileges;

insert image description here

  1. Configure the system environment, copy the path of mysql to the bin folder, and add it to Path
    insert image description here
    insert image description here
    insert image description here
    insert image description here

Guess you like

Origin blog.csdn.net/weixin_44442366/article/details/131068379