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注释掉;