不进入mysql查看表_mysql root看不到mysql表

1.首先停止mysql服务:service mysqld stop

2.加参数启动mysql:/usr/bin/mysqld_safe --skip-grant-tables &

然后就可以无任何限制的访问mysql了

3.root用户登陆系统:mysql -u root -p mysql

4.切换数据库:use mysql

5.显示所有的表:show tables;

这里就可以访问表了

6.查看user表中root用户的localhost权限:select * from user where user='root' and host='localhost'

7.在显示的列表中显示:root用户的localhost的权限都是'N',表示root用户本地登陆不具有权限

8.修改root用户的localhost权限:

update user set

`Select_priv` = 'Y',

`Insert_priv` = 'Y',

`Update_priv` = 'Y',

`Delete_priv` = 'Y',

`Create_priv` = 'Y',

`Drop_priv` = 'Y',

`Reload_priv` = 'Y',

`Shutdown_priv` = 'Y',

`Process_priv` = 'Y',

`File_priv` = 'Y',

`Grant_priv` = 'Y',

`References_priv` = 'Y',

`Index_priv` = 'Y',

`Alter_priv` = 'Y',

`Show_db_priv` = 'Y',

`Super_priv` = 'Y',

`Create_tmp_table_priv` = 'Y',

`Lock_tables_priv` = 'Y',

`Execute_priv` = 'Y',

`Repl_slave_priv` = 'Y',

`Repl_client_priv` = 'Y',

`Create_view_priv` = 'Y',

`Show_view_priv` = 'Y',

`Create_routine_priv` = 'Y',

`Alter_routine_priv` = 'Y',

`Create_user_priv` = 'Y',

`Event_priv` = 'Y',

`Trigger_priv` = 'Y',

`Create_tablespace_priv` = 'Y'

where user='root' and host='localhost

9.更新一下:flush privileges;

10.然后重新启动下mysql,可以解决问题了

1.首先停止mysql服务:service mysqld stop

2.加参数启动mysql:/usr/bin/mysqld_safe --skip-grant-tables &

然后就可以无任何限制的访问mysql了

3.root用户登陆系统:mysql -u root -p mysql

4.切换数据库:use mysql

5.显示所有的表:show tables;

这里就可以访问表了

6.查看user表中root用户的localhost权限:select * from user where user='root' and host='localhost'

7.在显示的列表中显示:root用户的localhost的权限都是'N',表示root用户本地登陆不具有权限

8.修改root用户的localhost权限:

update user set

`Select_priv` = 'Y',

`Insert_priv` = 'Y',

`Update_priv` = 'Y',

`Delete_priv` = 'Y',

`Create_priv` = 'Y',

`Drop_priv` = 'Y',

`Reload_priv` = 'Y',

`Shutdown_priv` = 'Y',

`Process_priv` = 'Y',

`File_priv` = 'Y',

`Grant_priv` = 'Y',

`References_priv` = 'Y',

`Index_priv` = 'Y',

`Alter_priv` = 'Y',

`Show_db_priv` = 'Y',

`Super_priv` = 'Y',

`Create_tmp_table_priv` = 'Y',

`Lock_tables_priv` = 'Y',

`Execute_priv` = 'Y',

`Repl_slave_priv` = 'Y',

`Repl_client_priv` = 'Y',

`Create_view_priv` = 'Y',

`Show_view_priv` = 'Y',

`Create_routine_priv` = 'Y',

`Alter_routine_priv` = 'Y',

`Create_user_priv` = 'Y',

`Event_priv` = 'Y',

`Trigger_priv` = 'Y',

`Create_tablespace_priv` = 'Y'

where user='root' and host='localhost

9.更新一下:flush privileges;

10.然后重新启动下mysql,可以解决问题了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值