windows查看端口是否占用+Windows MySQL8修改密码

windows查看端口是否占用

进去命令提示符之后,输入netstat -ano命令
查看所有被占用端口及PID

筛选端口查看PID

以8080端口为例:

netstat -aon|findstr 8080

筛选PID查看进程

筛选出PID为2524的进程

tasklist|findstr 2524

强制杀死pid为2524的进程
-t杀死子进程

taskkill /f /pid 2524

Windows MySQL修改密码

1.停止你正在运行的mysql
命令行:net stop mysql

修改配置文件: ,在配置文件mysqld下添加 skip-grant-tables

重新启动mysql

net start mysql
输入:mysql -u root -p,回车进入mysql(此时不需要密码即可直接进入)

以下报错不一定会出现,如果不出现报错可以直接修改密码“注意完成之后把配置文件添加的 注释掉”

输入:use mysql;

输入:update user set authentication_string=‘’ where user=‘root’;,将authentication_string 置空;
输入:alter user ‘root’@‘localhost’ identified by ‘newpassword’;,newpassword为要修改的新密码;

此时提示错误:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

输入:FLUSH PRIVILEGES;

再重新alter user ‘root’@‘localhost’ identified by ‘newpassword’;

此时错误提示为:ERROR 1524 (HY000): Plugin ‘auth_socket’ is not loaded

输入select user,plugin from mysql.user;来查看plugin

这里输入update user set plugin=‘mysql_native_password’ where user=‘root’;将plugin改为以前版本的密码认证方式

然后输入:FLUSH PRIVILEGES;
再重试alter user ‘root’@‘localhost’ identified by ‘newpassword’;即可修改密码

修改完成后输入FLUSH PRIVILEGES;

将第一步的skip-grant-tables注释掉;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值