MySql错误代码1045的解决方案 | 您所在的位置:网站首页 › sqlyog连接mysql数据库错误1045 › MySql错误代码1045的解决方案 |
方法一: # /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; mysql> FLUSH PRIVILEGES; mysql> quit # /etc/init.d/mysql restart # mysql -uroot -p Enter password: mysql> 方法二: 直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: # mysql -udebian-sys-maint -p Enter password: mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; mysql> FLUSH PRIVILEGES; mysql> quit # mysql -uroot -p Enter password: mysql> 内容来自: 脚本之家 www.jb51.net 另一个方法Windows: 1. 管理员登陆系统,停止mysql服务或者结束mysqld-nt进程2. 进入命令行,来到mysql的安装目录.假设安装目录为 d:\mysql\ , CMD进入命令行3. 运行 d:\mysql\bin\mysqld-nt --skip-grant-tables 启动mysql,关闭权限的检查4. 运行 d:\mysql\bin\mysqladmin -u root flush-privileges password "newpassword" 重设root密码5. 重新启动mysql服务 |
CopyRight 2018-2019 实验室设备网 版权所有 |