Complete steps to delete and install decompressed version of mysql

(If installing for the first time, ignore steps 1, 2, 3)


  1. Stop the mysql service in the computer right click on my computer → select management → select services and applications → service → view MYSQL service → right click to stop the service
  2. Delete mysql service
    Start the command line as an administrator, enter sc delete mysql
    [SC] DeleteService successfully deleted successfully!
  3. Delete the data directory in the original mysql
  4. Download the mysql decompressed version compressed package on the official website.
    Click to jump to the mysql download address. :https://dev.mysql.com/downloads/mysql/
    This is what I downloaded before.

  This is what I placed before

  1. Decompress the downloaded compressed package.
    My unzipped mysql root directory isD:\mysql\mysql-8.0.19-winx64

Insert picture description here

  1. Configure environment variables
    Right-click My Computer→Properties→Advanced System Settings→Environment Variables→ System Variables (Not a user variable)
    Create a new system variable, enter the variable name, mine is mysql (not necessarily mysql, just as the name implies), the variable value is the root directory of the mysql installation

Insert picture description here
Find the path in the system variables, double-click to edit, create a new, the content is %mysql%\bin(Mysql here is the variable name above), that is, the bin directory under the mysql folder.
7. Under the root directory of the unzipped mysql, create a new text document, modify the suffix of the text document from .txt to my.ini, and edit the content. The following is my mysql my.ini The content (can be copied, the comment part needs to be changed) insert the code piece here

[client]
default-character-set=utf8mb4
port            = 3306

[mysqld]
port            = 3306
basedir         = D:/mysql/mysql-8.0.19-winx64    #mysql安装根目录 
datadir         = D:/mysql/mysql_data             #mysql的data目录,上文有提到

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

default-time_zone='+8:00'
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password

max_allowed_packet = 256M
max_connections=20


[mysqldump]
quick
max_allowed_packet = 256M

[mysql]
default-character-set=utf8mb4
auto-rehash
  1. Run the cmd command line window
    as an administrator and enter the following command:
#此命令根据my.ini的路径创建data目录,并将初始化的密码写在控制台(大概是在提示信息的最末尾),之后第一次登陆需要用到
mysqld --initialize -console 

#执行完install命令出现Service successfully installed     
mysqld install

#启动服务
net start mysql

#使用初始化密码登陆mysql
mysqladmin -u root -p 初始化密码

#登陆成功后修改密码
alter user user() identified by '新密码';

It's over! Spread flowers ( *^▽^*)! If you have any questions, please discuss it together!

Guess you like

Origin blog.csdn.net/qq_42193799/article/details/115343653