当前位置:嗨网首页>书籍在线阅读

15-skip-show-database

  
选择背景色: 黄橙 洋红 淡粉 水蓝 草绿 白色 选择字体: 宋体 黑体 微软雅黑 楷体 选择字体大小: 恢复默认

使用 skip-show-database选项,只允许有 show databases权限的用户执行 show databases语句,该语句显示所有数据库名。不使用该选项,允许所有用户执行 show databases,但只显示用户有 show databases 权限或部分数据库权限的数据库名。下面的例子显示了启用此选项后show databases的执行结果:

[root@localhost bin]# mysqld_safe --skip-show-database &

[1] 15027

[root@localhost bin]# Starting mysqld daemon with databases from /var/lib/mysql

[root@localhost bin]# mysql -uz2

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.0.41-community-log MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;

ERROR 1227 (42000): Access denied; you need the SHOW DATABASES privilege for this operation