今天学习mysql用户管理,不小心将mysql.user表中的root用户给删掉了,然后就无法登录mysql了,网上找到了linux下的解决方法,我做了简单的修改,改成了我的windows版,恢复方法如下: 1.关闭mysql服务 net stop mysql 或者 wamp工具关闭 2.启动无需验证用户的特权使用模式 切换到mysql的bin目录,执行mysqld --console --skip-grant-tables 3.使用root用户登录(没有密码),重新授权 grant all
Windows系统下一:进入Windows窗口cmd命令行下,停止mysql服务: net stop mysql二:进入mysql的安装目录下,进去bin目录mysqld-nt.exe --skip-grant-tables三:再另一个窗口下,进去mysql的安装目录,并修改密码:执行mysql.exe>use mysql;>update set user password=password("new_pass") where user="root";&
#1.停止mysql数据库 /etc/init.d/mysqld stop #2.执行如下命令 mysqld_safe --user=mysql --skip-grant-tables --skip-networking & #3.使用root登录mysql数据库 mysql -u root mysql #4.更新root密码 mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; #最新版MySQ
mysql默认只能从本地连接,所以要使root可以远程访问登录,需做如下设置: 1.授权 请使用以下命令 mysql> Grant all privileges on *.* to 'root'@'%' identified by 'kdm001' with grant option; (%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名:‘root’则是指要使用的用户名,) mysql> flush privileges; Query OK, rows affected (0.
忘记root密码怎么办:1.关闭数据库2.使用-->mysqld_safe --skip-grant-tables &--<启动数据库3.使用空密码进入数据库(mysql命令后直接回车)4.使用update语句修改root密码,然后刷新权限表5.关闭数据库并重新以正常方式启动数据库操作步骤如下:#service mysql stop#mysqld_safe --skip-grant-tables &#service mysql start#mysqlmysql> upda