Install and uninstall MySQL via (.zip compressed file)

1. MySQL installation

1. Download the MySQL compressed package

insert image description here

2. Unzip the downloaded compressed package to a directory without a Chinese path

insert image description here
insert image description here

3. Configure MySQL environment variables

  1. This Computer→Properties→Advanced System Settings→Environment Variables

    insert image description here
    insert image description here
    insert image description here

  2. New→Variable name: MYSQL_HOME→Variable value: Decompression directory of MySQL compressed package→OK

    insert image description here
    insert image description here

  3. Path→New→%MYSQL_HOME%\bin→OK→OK→OK

    insert image description here
    insert image description here
    insert image description here
    insert image description here
    insert image description here

4. Verify whether the configuration is successful

  1. Run command prompt as administrator

    insert image description here

  2. Enter mysqlEnter → appear Can't connect to MySQL server on 'localhostto prove that the addition is successful

    insert image description here

5. Initialize the MySQL database

#执行如下命令初始化数据库
mysqld --initialize-insecure

insert image description here

初始化完成后,MySQL解压目录下会生成一个data目录,data目录里面存放的就是MySQL的数据

6. Register MySQL service

mysqld -install

insert image description here
insert image description here

计算机上已经安装好了MySQL服务了

7. Start the MySQL service

//启动mysql服务
net start mysql 
//停止mysql服务
net stop mysql 

insert image description here
insert image description here

8. Modify the MySQL database default account password

mysqladmin -u root password root

insert image description here

这里的 root 就是指默认管理员(即root账户)的密码,可以根据自己进行修改。

9. Log in to the MySQL database

mysql -uroot -proot

insert image description here

左下角为 mysql> ,则登录成功。

10. Exit MySQL

exit
quit

insert image description here

Two, MySQL uninstall

1. Run Command Prompt as administrator

insert image description here

2. Stop the MySQL service

net stop mysql

insert image description here

3. Uninstall the MySQL service

mysqld -remove mysql

insert image description here

4. Delete the MySQL directory and related environment variables, that is, the MySQL uninstallation is complete!

Guess you like

Origin blog.csdn.net/weixin_44904239/article/details/131653062