MYSQL5.6 OCP 1Z0-883 5.6题库及解析二

11.You are using replication and the binary logfiles on your master server consume a lot of disk space.

Which two steps should you perform to safely remove some of the older binarylog files?

A.Ensure that none of the attached slaves are using any of the binary logs youwant to delete.

B.Use the command PURGE BINARY LOGS and specify a binary log file name or adate and time to remove unused files.

C.Execute the PURGE BINARY LOGE NOT USED command.

D.Remove all of the binary log files that have a modification date earlier thantoday.

E.Edit the .index file to remove the files you want to delete.

---------------------------------------------------------------------------

答案:AB

分析:

A

是必须要保证的,你的删除的肯定不能正被slave使用啦。

PURGE LOGS

语法PURGE { BINARY | MASTER } LOGS { TO

'log_name' | BEFORE datetime_expr },所做操作会对.index文件进行自动更新。因此B正确,E错。

C

错,无此语法。

D

错,具体清理到什么位置需要按照SHOW SLAVE STATUS来查看,而不是武断地确定删除早于今天的binary log文件。


12.Which two statements are true about InnoDBauto-increment locking?

A.The auto-increment lock can be a table-level lock.

B.InnoDB never uses table-level locks.

C.Some settings for innodb_autoinc_lock_mode can help reduce locking.

D.InnoDB always protects auto-increment updates with a table-level lock.

E.InnoDB does not use locks to enforce auto-increment uniqueness.

---------------------------------------------------------------------------

答案:A, C

分析:

auto-increment的AUTO-INC锁是一个表级锁,因此A正确,B和E错误,。

C

正确,根据数据库参数innodb_autoinc_lock_mode的设置,插入操作会根据模式和所用语句的不同选用相应的锁。innodb_autoinc_lock_mode = 2的时候,将不使用表级锁和轻量mutex锁,不过在基于语句复制(SBR: Statement Based Replication)时,会有交错序列风险。参考:http://dev.mysql.com/doc/refman/ ... ement-handling.htmlhttp://dev.mysql.com/doc/refman/ ... t-configurable.html


13.Consider the Mysql Enterprise Audit plugin.

A CSV file called data.csv has 100 rows of data.

The stored procedure prepare_db() has 10 auditable statements.

You run the following statements in the mydb database:


Mysql> CALL prepare_db();

Mysql> LOAD DATA INFILE '/tmp/data.cav' INTO TABLE mytable;

Mysql> SHOW TABLES;

How many events are added to the audit log as a result of the precedingstatements?

A.102; top-level statements are logged, but LOAD DATA INFILE is logged as aseparate event.

B.3; only the top-level statements are logged.

C.111; top-level statements and all lower-level statements are logged.

D.12; only top-level statements and stored procedure events are logged.

----------------------------------------

答案:B

分析:

audit.log

文件中每个<AUDIT_RECORD>元素代表了一个事件,如客户连接或关闭连接事件,执行SQL语句等。仅顶层语句会被记录下来,存储程序(如触发器或存储过程)中的语句不会被记录。命令如LOAD DATA INFILE在进行操作时,其对文件内容进行进行操作的具体细节不会被记录。因此,A, C, D错,B正确。参考:http://dev.mysql.com/doc/refman/ ... ogging-control.html


14.You execute the following statement in aMicrosoft Windows environment. There are no conflicts in the path namedefinitions.

C: \> mysqld

–-install Mysql56 –-defaults–file=C:\my–opts.cnf

What is the expected outcome?

A.Mysqld acts as an MSI installer and installs the Mysql 5.6 version, with thec:\my-opts.cnf 

configuration file.

B.Mysql is installed as the Windows service name Mysql56, and usesc:\my-opts.cnf as the


configuration file

C.An error message is issued because

–-install is not a validoption for mysqld.

D.A running Mysql 5.6 installation has its runtime configuration updated withthe server variables 

set in c:\my-opts.cnf.

------------------------------------------

答案:B

分析:首先mysqld是作为MySQL服务端主程序来运行的,它并不负责MSI安装的过程,因此A错。通过mysqld --install可以进行Windows服务注册,同时--defaults-file用于设置启动服务端时使用的配置文件,B正确。请注意--install命令项仅存在于Windows版MySQL的mysqld命令中,如果你是在Linux上安装MySQL是无法找到mysqld对应的--install命令项的。

C

错误,因为其对于Windows版的mysqld是有效项。

D

错,因此这命令不是用于安装时的配置。参考:

http://dev.mysql.com/doc/refman/5.7/en/windows-start-service.html



15、Which two methods will clearor reset the collected events in the tables?

Consider the events_% tables in performance Schema. 

Which two methods will clear or reset the collected events in the tables?

A.Using DELETE statements, for example, DELETE FROMperformance_schema.events_watis_current;

B.Using the statement RESET PERFORMANCE CACHE;

C.Using the statement FLUSH PERFORMANCE CACHE;

D.Using TRUNCATE statements, for example, TRUNATE TABLEperformance_schema.events_waits_current;

E.Disabling and re-enabling all instruments

F.Restarting Mysql

答案:DE


16. What are fourcapabilities of the mysql client program?

A.Creating and dropping databases

B.Creating, dropping, and modifying tables and indexes

C.Shutting down the server by using the SHUTDOWN command

D.Creating and administering users

E.Displaying replication status information

F.Initiating a binary backup of the database by using the START BACKUP command

--------------------------------------

答案:A,B,D,E

分析:首先我们需要分清楚MySQL和mysql这两个词的概念,MySQL是指MySQL整个数据库和其软件,而mysql则是其软件中涵盖的一个客户端工具。本题考的是对这些客户端工具使用。在使用mysql命令行工具登陆服务端后,可以执行的命令也非常多,比如建立和删除数据库,表和索引的增删改等。你也可以使用mysql客户端工具来建立用户,并进行对用户的权限和访问进行管理。当然在Master-Slave Replication的主库和从库,你也可以使用show

master status及show slave status来查看复制的状态情况。因此, ABDE都是正确的。至于关闭MySQL Server,这有多种方式,其中一种是使用mysqladmin客户端工具shutdown命令来实现的,mysql客户端工具不负责这事。而备份,逻辑备份可使用mysqldump 或mysqlpump(从MySQL 5.7.6开始)。而binary backup则可以使用mysqlbackup(如果你的MySQL是企业版的话)或使用copy表文件的方式来进行备份,而不是在mysql命令行工具中键入START BACKUP命令。参考:http://dev.mysql.com/doc/refman/5.7/en/programs-client.htmlhttp://dev.mysql.com/doc/refman/5.7/en/show-slave-status.htmlhttp://dev.mysql.com/doc/refman/5.7/en/mysqladmin.htmlhttp://dev.mysql.com/doc/refman/5.7/en/backup-methods.html


17.Assume that you want to know which MysqlServer options were set to custom values.

Which two methods would you use to find out?

A.Check the configuration files in the order in which they are read by theMysql Server and compare them with default values.

B.Check the command-line options provided for the Mysql Server and compare themwith default values.

C.Check the output of SHOW GLOBAL VARIABLES and compare it with default values.

D.Query the INFORMATION_SCHEMA.GLOBAL_VARIABLES table and compare the resultwith default values.

答案:C, D (for MySQL 5.6) C (for MySQL 5.7)

分析;

MySQL Server

配置项由多处设置组成,由于Server的主程序为mysqld,因此其命令项设置也主要是看mysqld对应的项的设置。在命令项设置后,启动后相应项反应在数据库上,就是那些Global Variables全局变量了,当用户会话访问时,其Session Variables则会copy自全局变量值,之后用户可以根据需要使用SET命令来修改会话变量。当然如果有足够的权限,用户也可以修改全局变量,不过这种修改仅应用于正在运行MySQL Server,且对之后新登陆会话有效,一旦Server重启就打回原形了。此题中,主要是希望查看启动后,使用的全局变量和其默认值修改情况,一般在启动初始化时,我们可以提前通过mysqld的命令行项上直接修改,或使用配置文件来进行启动时候的项的默认修改。但是A, B都是错的,因为你无法确认MySQL Server的全局变量在启动后是否有人为被再次修改过。

C

正确,因为show global variables可以了解当前所有全局变量值,从而和默认值进行比较。请注意:show variables指的是查看当前会话变量,因此一定要加上global。

D

在MySQL 5.6版本中正确,因为其global

variables值存放于此表中。不过在5.7版本,GLOBAL_VARIABLES这张表被移至performance_schema下,原先INFORMATION_SCHEMA.GLOBAL_VARIABLES将成为空表并被弃用。参考:http://dev.mysql.com/doc/refman/5.7/en/option-files.htmlhttp://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html


18.You install a copy of Mysql 5.6.13 on a

brand new Linux server by using RPM packages. The server starts successfully as

verified by the following commands: 

$ pidof mysqld

3132

$ tail

–n2 /var/lib.mysql/hostname.err

2013-08-18 08:18:38 3132 [Note] /usr/sbin/mysqld: ready for connections.

Version: '5.6.13-enterprise-commercial-advanced' socket: '/tmp/mysql.sock'port: 3306

Mysql Enterprise Server

–Advanced Edition (Commercial)

You attempt to log in as the root user with the following command: 

$ mysql

–u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:NO)

Which statement is true about this scenario?

A.The RPM installation script sets a default password of password for newinstallations.

B.The local root user must log in with a blank password initially: mysql

–u root –p.

C.New security measures mean that the mysql_secure_installation script must berun first on all new installations.

D.The mysql_install_db post-installation script used

–-random-passwords.

--------------------------------------

答案:D

分析:

MySQL5.6 Linux RPM

包安装中会调用带有--random-passwords参数项的mysql_install_db脚本命令, 为root用户生成一个随机密码,并保存在$HOME/.mysql_secret文件中。

A

错,生成的是一个随机密码,而非默认密码。B错,因为本地root用户已经有一个生成的密码了,因此空密码是不能登陆成功的。

C

错,mysql_secure_installation是一个非必要脚本,在MySQL安装完成后,你可以运行此脚本来进一步增强其安全策略。参考:http://dev.mysql.com/doc/refman/

... stallation-rpm.htmlhttp://dev.mysql.com/doc/refman/

... e-installation.html


19.A Mysql Server has been running an existing

application successfully for six months.

The my.cnf is adjusted to contain the following

additional configuration:

[mysqld]

default-authentication-plugin=sha256_password

The Mysql Server is restarted without error.

What effect will the new configuration have in

existing accounts?

A.They will have their passwords updated on

start-up to sha256_password format

B.They will have to change their password the next

time they login to the server

C.They are not affected by this configuration

change

D.They all connect via the secure

sha256_password algorithm without any configuration change.

-----------------------------

答案:C分析:

default-authentication-plugin

的作用是为了在create user时默认其所使用的密码加密格式。其和已经建立的用户所使用的密码格式无关,因此A,B错。在客户端工具进行连接时,服务端会在mysql.user表中进行匹配,以了解对应登陆用户所使用的密码格式,并以此授权方式进行登陆验证,因此D错。参考:http://dev.mysql.com/doc/refman/

... ication-plugin.html


20、In a design situation, there

are multiple character sets that can properly encode your data.

Which three should influence your choice of

character set?

A.Syntax when writing queries involving JOINS

B.Syntax when writing queries involving JOINS

C.Memory usage when working with the data

D.Character set mapping index hash size

E.Disk usage when storing data

答案:CDE

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 199,340评论 5 467
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 83,762评论 2 376
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 146,329评论 0 329
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,678评论 1 270
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,583评论 5 359
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 47,995评论 1 275
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,493评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,145评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,293评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,250评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,267评论 1 328
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,973评论 3 316
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,556评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,648评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,873评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,257评论 2 345
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 41,809评论 2 339