mysql 设置、更改、找回密码
1,新装mysql,添加密码
mysqladmin -u root password NEWPASSWORD
2,记得旧密码,改密码
mysqladmin -u root -p'OLDPASSWORD' password NEWPASSWORD
3,不记得旧密码,新设密码
- Stop the MySQL server process with the command: sudo service mysql stop
- Start the MySQL server with the command: sudo mysqld_safe —skip-grant-tables —skip-networking &
- Connect to the MySQL server as the root user with the command: mysql -u root
At this point, you need to issue the following MySQL commands to reset the root password:
mysql> use mysql;
mysql> update user set authentication_string=password('NEWPASSWORD') where user='root';
mysql> flush privileges;
mysql> quit
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步