日期:2014-05-16  浏览次数:20882 次

mysql root权限 重装及忘记密码的解决办法
Mysql的安装和卸载
? 可以把Mysql安装在非系统盘,重装系统后只需重新注册一下Mysql服务即可.
??? > cd ../bin?????????? //进入Mysql路径下的bin目录中
????> mysqld-nt -install? //添加Mysql服务
?
??卸载Mysql的方法
??? > cd ../bin?????????? //进入Mysql路径下的bin目录中
??? > mysqld-nt -remove?? //卸载Mysql服务
??? >???????????????????? //然后可以在Control Panel中 remove Mysql软件
?
忘记密码的解决办法
??? > net stop msyql????? //停止Mysql服务????| >killall -TERM mysqld??? //Linux下end mysql服务
??? >cd? ../bin?????????? //进入Mysql路径下的bin目录中
????>mysqld-nt --skip-grant-tables? //让mysql服务跳过认证运行,保持这个窗口不关闭? |>bin/safe_mysqld --skip-grant-tables &? //Linux下
???
??? >mysql -uroot???????? //另打开一个shell,执行Mysql
??? >use?? mysql????????? //切换数据库为mysql
??? >update user set password=password("new_pass") where user="root";? //更新用户密码
??? >flush privileges;??? //更新Mysql权限表
??? >exit???????????????? //退出Mysql
??? >exit???????????????? //关闭shell
????????????????????????? //>然后在任务管理器里面end mysql-nt process
????>mysql-nt?????????????//在第一次打开的shell中重新run mysql-nt process
????????????????????????? //>然后就可以用新的密码登陆Mysql了
如果root 没有所有数据的权限
更新的MYSQL.USER表的所有字段中为N的为Y就可以了。
update user set Select_priv ='Y' where user = 'root';
update user set Insert_priv ='Y' where user = 'root';
update user set Update_priv ='Y' where user = 'root';
update user set Delete_priv ='Y' where user = 'root';
update user set Create_priv ='Y' where user = 'root';
update user set Drop_priv ='Y' where user = 'root';
update user set Reload_priv ='Y' where user = 'root';
update user set Shutdown_priv ='Y' where user = 'root';
update user set Process_priv ='Y' where user = 'root';
update user set File_priv ='Y' where user = 'root';
update user set Grant_priv ='Y' where user = 'root';
update user set References_priv ='Y' where user = 'root';
update user set Index_priv ='Y' where user = 'root';

update user set Alter_priv ='Y' where user = 'root';
update user set Show_db_priv ='Y' where user = 'root';
update user set Super_priv ='Y' where user = 'root';
update user set Create_tmp_table_priv ='Y' where user = 'root';
update user set Lock_tables_priv ='Y' where user = 'root';
update user set Execute_priv ='Y' where user = 'root';
update user set Repl_slave_priv ='Y' where user = 'root';
update user set Repl_client_priv ='Y' where user = 'root';
update user set Create_view_priv ='Y' where user = 'root';
update user set Show_view_priv ='Y' where user = 'root