龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 数据库类 > MySQL 技术 >

更改root密码和恢复MySQL root用户

时间:2011-03-14 23:24来源:未知 作者:admin 点击:
分享到:
更改root密码和恢复 mysql教程 root用户 我不小心删除了mysql的root帐号。我该怎么办?和我失去了我的根密码?这种问题经碰到,那么你碰这类问题时是备份数据,重新安装mysql和恢复所有

更改root密码和恢复mysql教程 root用户
我不小心删除了mysql的root帐号。我该怎么办?"和"我失去了我的根密码?这种问题经碰到,那么你碰这类问题时是备份数据,重新安装mysql和恢复所有数据库教程文件?还是怎么办,我们现在为你找到一个更好的办法。

1、停止mysql ,
2、服务器权限
c:www.111cn.netbinmysqld-nt.exe --skip-grant-tables
    where c:www.111cn.net is mysql'instalation directory.
    如果是linux就如下执行命令
    /usr/local/mysql/bin/mysqld_safe --skip-grant-tables --user=root --skip-networking
3、连接到服务器使用exsisting帐户(root或某些otherif root帐户被删除)。
     c:www.111cn.netbinmysql.exe -u user
     or
     /usr/local/mysql/bin/mysql -u user
    
4、更改mysql 查询密码
 update mysql.user set password=password('newpwd') where user='root';
    or recreating user:
        create user root identified by password 'newpwd';
        grant all privileges on * . * to 'root'@ 'localhost' identified by 'newpwd' with grant option max_queries_per_hour 0 max_connections_per_hour 0 max_updates_per_hour 0 max_user_connections 0 ;

5、刷新权限
 flush privileges;

6、重新启动服务器
ok mysql root密码就被你找回来了哈。

更改root密码和恢复MySQL root用户更多相关文章

精彩图集

赞助商链接