dbdao吧 关注:1,219贴子:4,060

【dbdao.com MySQL OCP认证专题】- MySQL 5.6 - OCP 考题讲解

取消只看楼主收藏回复

获取MySQL 5.6 DBA ocp 需要通过如下的考试:
MySQL 5.6 Database Administrator 1Z0-883


如果是MySQL 5.6 Developer ocp 则需要通过:
MySQL 5.6 Developer 1Z0-882


考试通过,即可申请对应ocp认证


回复
1楼2015-10-23 17:00
    A simple master-to-slave replication is currently being used. The following information is extracted from the SHOW SLAVE STATUS output:
    Last_SQL_Error: Error 'Duplicate entry '8' for key 'PRIMARY'' on query. Default database: 'mydb'.
    Query: 'insert into mytable VALUES ('8', 'George')'
    Skip_Counter: 0
    Retrieved_Gtid_Set: 38f32e23480a7-32a1-c323f78067fd37821: 1-8
    Auto_Position: 1
    You execute a "SHOW CREATE TABLE mytable" on the slave:
    CREATE TABLE 'mytable' (
    'ID' int(11) NOT NULL DEFAULT '0',
    'name' char(10) DEFAULT NULL,
    PRIMARY KEY ('ID')
    )
    The table mytable on the slave contains the following:




    You have issued a STOP SLAVE command. One or more statements are required before you can
    issue a START SLAVE command to resolve the duplicate key error.
    Which statement should be used?
    A)
    SET GLOBAL SQL_SKIP_SLAVE_COUNTER=1
    B)
    SET GTID_NEXT="CONSISTENCY";
    BEGIN; COMMIT;
    SET GTID_NEXT=" AUTOMATIC’;
    C)
    SET GLOBAL enforce_gtid_consistency=ON
    D)
    SET GTID_EXECUTED="38f32e23480a7-32a1-c323f78067fd37821 : 9";
    E)
    SET GTID_NEXT="38f32e23480a7-32a1-c323f78067fd37821 : 9";
    BEGIN; COMMIT;
    SET GTID_NEXT="AUTOMATIC";
    --------------------------------------------------------------------
    答案:E
    分析:此题中使用的Replication是通过GTID实现的,因此
    A错,因此GLOBAL SQL_SKIP_SLAVE_COUNTER=1对使用GTID进行的Replication无效
    C错,因为GLOBAL enforce_gtid_consistency=ON是实现的前提。
    由于GTID_NEXT的有效值为:
    AUTOMATIC / ANONYMOUS / <UUID>:<NUMBER>
    因此 B错
    由于Retrieved_Gtid_Set: 38f32e23480a7-32a1-c323f78067fd37821: 1-8
    因此已经收到主库事务1-8,因此报错是从第9个事务重复记录导致的,很有可能slave上的第8行被人为录入了,导致同步问题。
    D错,因为GTID_EXECUTED表示已经执行完成的事务。


    为了临时绕过这个问题,使用注入空事务(BEGIN; COMMIT; ) 代替完成第9个事务.
    完成后GTID_EXECUTED才会变为"38f32e23480a7-32a1-c323f78067fd37821 : 9"
    这时候重新SET GTID_NEXT="AUTOMATIC"; 重启slave后,开始从第10个事务开始同步。


    收起回复
    2楼2015-10-23 17:32
      Consider the following statement on a RANGE partitioned table:
      ALTER TABLE orders DROP PARTITION p1, p3;
      What is the outcome of executing the above statement?


      A.
      Only the first partition (p1) will be dropped as only one can be dropped at any time.
      B.
      All data in p1 and p3 partitions are removed, but the table definition remains unchanged.
      C.
      A syntax error will result as you cannot specify more than one partition in the same statement.
      D.
      All data in pi and p3 partitions are removed and the table definition is changed.
      --------------------------------------------------------------------

      答案:D
      在删除部分分区后,可以使用show create table查看其定义也一并改变了


      参考:
      http://dev.mysql.com/doc/refman/5.7/en/alter-table-partition-operations.html


      收起回复
      3楼2015-10-24 10:11
        3.


        You inherit a legacy database system when the previous DBA, Bob, leaves the company. You are
        notified that users are getting the following error:
        mysql> CALL film_in_stock (40, 2, @count);
        ERROR 1449 (HY000): The user specified as a definer ('bob'@'localhost') does not exist
        How would you identify all stored procedures that pose the same problem?


        A.
        Execute SELECT * FROM mysql.routines WHERE DEFINER='bob@localhost';.


        B.
        Execute SHOW ROUTINES WHERE DEFINER='bob@localhost'.


        C.
        Execute SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE DEFINER='bob@localhost';.


        D.
        Execute SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER='bob' and HOST='localhost';.


        E.
        Examine the Mysql error log for other ERROR 1449 messages.
        ----------------------------------------------------------------------------------
        答案:C


        分析:routines表在库INFORMATION_SCHEMA下,因此A错。
        可以登陆MySQL后,使用? show命令查看show语法。可知show无routine语句,B错。


        可使用以下命令来查看routines:
        pager less;
        select * from information_schema.routines\G


        可知C正确


        INFORMATION_SCHEMA.PROCESSLIST表中仅显示了当前正在运行的线程信息,D错。
        Mysql error log是对报错信息的记录,并不会有所有存储过程的记录,E错。


        回复
        4楼2015-10-25 15:52
          5.
          ROW-based replication has stopped working. You investigate the error log file and find the following entries:
          2013-08-27 14:15:47 9056 [ERROR] Slave SQL: Could not execute Delete_rows event on table test.t1; Can’t find record in ‘t1’, Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event’s master log 56_master-bin.000003, end_log_pos 851, Error_code: 1032
          2013-08-27 14:15:47 9056 [warning] Slave: Can’t find record in ‘t1’ Error_code: 1032
          2013-08-27 14:15:47 9056 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with “SLAVE START”. We stopped at log ‘56_masterbin.000003’ position 684
          Why did you receive this error?


          A.
          The slave SQL thread does not have DELETE privileges to execute on test.t1 table.s
          B.
          The table definition on the slave litters from the master.
          C.
          Multi-threaded replication slaves can have temporary errors occurring for cross database
          updates.
          D.
          The slave SQL thread attempted to remove a row from the test.t1 table, but the row did not
          exist.
          -------------------------------------------------------------------------------------------
          答案:D
          分析:报错中说的非常明确Could not execute Delete_rows event on table test.t1; Can’t find record in ‘t1’,
          这说明slave上这条记录已经被人为删除了,导致Row-Based Replication进行同步删除的时候,找不到这条记录。ABC选项都和此报错以及所问问题无关。


          回复
          6楼2015-10-27 10:56
            6.
            mysqldump was used to create a single schema backup;
            Shell> mysqldump –u root –p sakila > sakila2013.sql
            Which two commands will restore the sakila database without interfering with other running
            database?


            A.
            Mysql> USE sakila; LOAD DATA INFILE 'sakila2013.sql';
            B.
            Shell> mysql –u root –p sakila < sakila2013.sql
            C.
            Shell> mysqlimport –u root –p sakila sakila2013.sql
            D.
            Shell> mysql –u root -p –e 'use sakila; source sakila2013.sql'
            E.
            Shell> mysql –u root –p –silent < sakila2013.sql


            --------------------------------------------------------------------------------
            答案:B
            分析:
            A错,load data infile针对的是select ... into oufile输出的表数据文件,其文件中不含有插入执行语句,仅含有数据。而mysqldump导出的文件包含的数据是以可执行sql语句实现的。
            C错,因此mysqlimport是类似于load data infile语句功能的shell命令行工具,因此对应倒入的文件都应该是非sql语句执行的纯表数据文件。
            我们看到mysqldump在未使用--database项导出时,并未在文件中使用create database语句。


            当导入数据库dump文件,你需要在命令中指定数据库名,即use db_name进入此库:
            shell> mysql db_name < dump.sql
            因此B正确
            mysql -e 可用于执行语句,但是mysql客户端语句需要使用分号作为终止符发给服务端,因此每个语句后都需要使用分号,D错误。


            如果D为Shell> mysql –u root -p –e 'use sakila; source sakila2013.sql;' 则正确。
            E错. mysql命令项使用中,短项使用单横杠,长命令项使用双横杠 -silent项应该时候双横杠,因此错。


            参考:
            http://dev.mysql.com/doc/refman/5.7/en/load-data.html
            http://dev.mysql.com/doc/refman/5.7/en/mysqlimport.html
            http://dev.mysql.com/doc/refman/5.7/en/mysql.html


            收起回复
            7楼2015-10-28 11:59
              Consider the Mysql Enterprise Audit plugin.
              You are checking user accounts and attempt the following query:
              Mysql> SELECT user, host, plugin FROM mysql.users;
              ERROR 1146 (42S02): Table ‘mysql.users’ doesn’t exist
              Which subset of event attributes would indicate this error in the audit.log file?


              A.
              NAME=”Query”
              STATUS=”1146”
              SQLTEXT=”select user,host from users”/>
              B.
              NAME=”Error”
              STATUS=”1146”
              SQLTEXT=”Error 1146 (42S02): Table ‘mysql.users’ doesn’t exist”/>
              C.
              NAME=”Query”
              STATUS=”1146”
              SQLTEXT=” Error 1146 (42S02): Table ‘mysql.users’ doesn’t exist”/>
              D.
              NAME=”Error”
              STATUS=”1146”
              SQLTEXT=”select user,host from users”/>
              E.
              NAME=”Error”
              STATUS=”0”
              SQLTEXT=”Error 1146 (42S02): Table ‘mysql.users’ doesn’t exist”/>


              ---------------------------------------------------------
              答案:A
              分析:
              注意:MySQL Enterprise Audit是包含在MySQL企业版中的一个扩展插件,因此如果你在学习时使用的是社区版的MySQL,那你是无法实验的。
              因为它需要在环境变量plugin_dir对应目录下存在audit_log.so插件文件。
              从选择答案中可知,Audit log中使用的是旧格式进行的记录。
              由于SQLTEXT仅在NAME为Query或Execute时,才会有出现,且NAME不存在Error状态。因此B,D,E错。
              而SQLTEXT仅存放所使用的SQL语句。而返回的状态存放在STATUS下,0为成功,非0为报错号,因此A对C错。
              参考:
              http://dev.mysql.com/doc/refman/5.7/en/audit-log-plugin.html
              http://dev.mysql.com/doc/refman/5.7/en/audit-log-file.html


              回复
              8楼2015-10-29 17:30
                8.
                Which query would you use to find connections that are in the same state for longer than 180 seconds?


                A.
                SHOW FULL PROCESSLIST WHERE Time > 180;


                B.
                SELECT * FROM INFORMATION_SCHEMA.EVENTS SHERE STARTS < (DATE_SUB(NOW(), INTERVAL 180 SECOND));


                C.
                SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE STATE < (DATE_SUB(NOW(), INTERVAL 180 SECOND));


                D.
                SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE TIME > 180;


                -------------------------------------------------
                答案:D
                分析:
                你可以使用 help show;命令来查看其语法可知:
                SHOW [FULL] PROCESSLIST
                此语法后面不可以跟where语句,因此A错。
                INFORMATION_SCHEMA.EVENTS表显示的是计划的作业,和连接保持的状态时间无关,B错。
                INFORMATION_SCHEMA.SESSION_STATUS表显示的是当前会话的变量及其变量值,和状态信息无关,C错。
                INFORMATION_SCHEMA.PROCESSLIST显示了当前的连接情况,状态,以及状态保持的时间,实际上show processlist也是查看的这张表,不过直接使用select可以使用where语句,D正确。




                参考:
                http://dev.mysql.com/doc/refman/5.7/en/information-schema.html


                回复
                9楼2015-10-30 11:21
                  A database exists as a read-intensive server that is operating with query_cache_type =
                  DEMAND.
                  The database is refreshed periodically, but the resultset size of the queries does not fluctuate.


                  —-Note the following details about this environment:
                  A web application uses a limited set of queries.
                  The Query Cache hit rate is high.
                  All resultsets fit into the Query Cache.
                  All queries are configured to use the Query Cache successfully.
                  The response times for queries have recently started to increase. The cause for this has correctly
                  been identified as the increase in the number of concurrent users accessing the web service.
                  Based solely on the information provided, what is the most likely cause for this slowdown at the
                  database level?


                  A.
                  The Query Cache is pruning queries due to an increased number of requests.
                  B.
                  Query_cache_min_res_unit has been exceeded, leading to an increased performance
                  overhead due to additional memory block lookups.
                  C.
                  Mutex contention on the Query Cache is forcing the queries to take longer due to its singlethreaded nature.
                  D.
                  The average resultset of a query is increasing due to an increase in the number of users
                  requiring SQL statement execution.


                  ---------------------------------------------------------------------------------------------------------
                  答案:C
                  分析:这是一个读密集型数据库,数据库会在一段时间后刷新,但是其查询的结果集大小波动不大。而所有结果集都在Query Cache中,且网页应用使用一套有限的查询语句。且Query Cache hit rate很高。
                  因此A,D错,请求通过的应用查询,查询语句数量有限,结果集都能放在Query Cache中,相同查询语句的请求不会增多Query Cache中的资源的占用,因此清理查询并非主要矛盾。
                  B也错,因此Query_cache_min_res_unit设置过大,仅会造成Query Cache中碎片过多。如果请求的结果集都能在Query Cache中,这就和碎片没什么关系了。
                  C正确,尽管官方文档中未大量解释Query Cache Mutex争用问题,在线程运行查询语句时,会在Query Cache中先获取Mutex锁,之后开始查询匹配的查询语句和结果集。如果找到后返回结果。
                  如果未找到匹配,在执行查询后,需要将查询语句和结果集插入Query Cache中,这也会需要获取锁。尽管这个时间所需非常短,但是在读密集的情况下,资源争用会导致线程排队等待现象。


                  参考:
                  http://dev.mysql.com/doc/refman/5.7/en/query-cache.html
                  http://dev.mysql.com/doc/refman/5.7/en/query-cache-configuration.html


                  收起回复
                  12楼2015-11-02 11:22
                    10.


                    You have a login-path named "adamlocal" that was created by using the mysql_config_editor
                    command.
                    You need to check what is defined for this login_path to ensure that it is correct for you
                    deployment.
                    You execute this command:
                    $ mysql_config_editor print –login-path=adamlocal
                    What is the expected output of this command?


                    A.
                    The command prints all parameters for the login-path. The password is printed in plain text.
                    B.
                    The command prints all parameters for the login-path. The password is shown only when you
                    provide the --password option.
                    C.
                    The command prints all parameter for the login-path. The password is replaced with stars.
                    D.
                    The command prints the encrypted entry for the login-path. The is only possible to see if an
                    entry exists.


                    ---------------------------------------------------
                    答案:C
                    分析:
                    mysql_config_editor工具命令用于建立外部登陆文件,一般由mysql客户端或应用来使用,好处在于登陆时免去输入登陆密码,密码已经被保存在了登陆文件中。在环境变量MYSQL_TEST_LOGIN_FILE未设置的情况下,mysql_config_editor默认文件名为.mylogin.cnf,且文件保存在执行此命令的用户home目录下。
                    登陆文件建立后,可直接使用以下命令登陆:
                    shell> mysql --login-path=login-path
                    当然,--login-path的默认值为client,因此如果你使用mysql_config_editer set --login-path=client 来进行用户密码设置设置,那么登陆所设用户的时候,连--login-path也可不用了:
                    shell> mysql


                    A, D错,因为不管如何,你都看不到密码的,密码被加密保存后,使用mysql_config_editor print会将密码替代以星号显示。
                    B错,使用mysql_config_editor --help可知在参数项中没有此--password项,且通过参考文档可知--password是用于设置密码而非显示密码的。
                    C正确。


                    参考:
                    http://dev.mysql.com/doc/refman/5.7/en/mysql-config-editor.html


                    收起回复
                    13楼2015-11-03 15:03
                      11


                      You are using replication and the binary log files on your master server consume a lot of disk space.
                      Which two steps should you perform to safely remove some of the older binary log files?


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


                      B.
                      Use the command PURGE BINARY LOGS and specify a binary log file name or a date 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 than today.


                      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文件。


                      参考:
                      http://dev.mysql.com/doc/refman/5.7/en/purge-binary-logs.html


                      回复
                      14楼2015-11-05 10:54
                        12.


                        Which two statements are true about InnoDB auto-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/5.7/en/innodb-auto-increment-handling.html
                        http://dev.mysql.com/doc/refman/5.7/en/innodb-auto-increment-configurable.html


                        回复
                        15楼2015-11-05 11:18
                          14.


                          You execute the following statement in a Microsoft Windows environment. There are no conflicts in the path name definitions.
                          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 the c:\my-opts.cnf
                          configuration file.
                          B.
                          Mysql is installed as the Windows service name Mysql56, and uses c:\my-opts.cnf as the
                          configuration file
                          C.
                          An error message is issued because –-install is not a valid option for mysqld.
                          D.
                          A running Mysql 5.6 installation has its runtime configuration updated with the 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


                          回复
                          17楼2015-11-07 14:12
                            17.


                            Assume that you want to know which Mysql Server 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 the Mysql Server and compare them with default values.
                            B.
                            Check the command-line options provided for the Mysql Server and compare them with 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 result with 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.html
                            http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html


                            回复
                            20楼2015-11-12 11:41
                              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 new installations.
                              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 be run 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/5.6/en/linux-installation-rpm.html
                              http://dev.mysql.com/doc/refman/5.6/en/mysql-secure-installation.html


                              回复
                              21楼2015-11-13 14:36
                                22.


                                Consider the query:
                                Mysql> SET @run = 15;
                                Mysql> EXPLAIN SELECT objective, stage, COUNT(stage)
                                FROM iteminformation
                                WHERE run=@run AND objective='7.1'
                                GROUP BY objective,stage
                                ORDER BY stage;


                                The iteminformation table has the following indexes;
                                Mysql> SHOW INDEXES FROM iteminformation:


                                This query is run several times in an application with different values in the WHERE clause in a growing data set.
                                What is the primary improvement that can be made for this scenario?


                                A.
                                Execute the run_2 index because it has caused a conflict in the choice of key for this query.
                                B.
                                Drop the run_2 index because it has caused a conflict in the choice of key for this query.
                                C.
                                Do not pass a user variable in the WHERE clause because it limits the ability of the optimizer to use indexes.
                                D.
                                Add an index on the objective column so that is can be used in both the WHERE and GROUP BY operations.
                                E.
                                Add a composite index on (run,objective,stage) to allow the query to fully utilize an index.


                                答案:E
                                分析:首先我们需要了解EXPLAIN命令执行后的输出含义,对应查询中Possible_Keys显示在查询时可使用Run和Run_2这两个索引来优化查询,Keys列则表明最终执行计划选择使用Run_2索引。
                                通过SHOW INDEXES FROM <table>命令,我们可以了解此表所有的索引,这里我们知道有Run(Run, Name)索引和Run_2(Run Stage)索引。
                                MySQL建立的联合索引,在利用这些索引时,你需要遵循leftmost prefix index(最左前缀索引)原则,即当你有一个索引为(col1, col2, col3),在查询时,查询条件中对(col1), (col1, col2)或(col1, col2, col3)
                                进行查询时可以使用到此索引。
                                由于Where中有run=@run,因此,索引Run和Run_2都满足被利用的条件,由于GROUP BY按规则无法利用这些索引,而ORDER BY则可以进一步利用stage索引,因此最终优化器选择使用Run_2索引。
                                A, B错,因此这种冲突说法不成立,因为索引的选择是由优化器选择的结果。C错,使用变量并不会对优化器使用索引进行限制。
                                D错,因此仅对objective列建立索引,并不会被GROUP BY使用。
                                E正确,因为建立(run,objective,stage)索引,此查询满足GROUP BY的Tight Index Scan规则,可以使用此索引提高查询性能。


                                参考:
                                http://dev.mysql.com/doc/refman/5.6/en/explain-output.html
                                http://dev.mysql.com/doc/refman/5.7/en/show-index.html
                                http://dev.mysql.com/doc/refman/5.6/en/group-by-optimization.html
                                http://dev.mysql.com/doc/refman/5.6/en/order-by-optimization.html


                                收起回复
                                25楼2015-11-17 13:14
                                  23.


                                  Consider typical High Availability (HA) solutions that do not use shared storage.
                                  Which three HA solutions do not use shared storage?


                                  A.
                                  MySQL Replication
                                  B.
                                  Distributed Replicated Block Device (DRBD) and Mysql
                                  C.
                                  Windows Cluster and MySQL
                                  D.
                                  Solaris Cluster and MySQL
                                  E.
                                  MySQL NDB Cluster


                                  答案:A, B, E
                                  分析:从图中的Shared Nothing我们就可以知道MySQL Replication,MySQL Fabric,DRBD,MySQL Cluster都符合要求,既然什么都不会共享使用,那么存储也一样不会被共享啦。


                                  Windows Cluster和Solaris Cluster都类似于第二,三张图所示,是共享存储的,因此CD被排除。






                                  MySQL Replication故名思意是复制,复制一个备库存储。DRBD是在系统级别的同步复制技术,数据库是不共享的。
                                  而MySQL NDB Cluster可以通过不同节点组来分散数据达到不共享存储的目的的,如第四张图。


                                  参考:
                                  http://dev.mysql.com/doc/refman/5.7/en/replication.html
                                  http://dev.mysql.com/doc/refman/5.7/en/ha-overview.html


                                  收起回复
                                  27楼2015-11-18 18:14
                                    24.


                                    Which three statements are characteristic of the MEMORY storage engine?


                                    A.
                                    Each table is represented on disk as an .frm file.
                                    B.
                                    Each table has a corresponding.MYI and .MYD file.
                                    C.
                                    It can support foreign keys.
                                    D.
                                    It cannot contain text or BLOB columns.
                                    E.
                                    Table contents are not saved if the server is restarted.
                                    F.
                                    It can support transactions


                                    答案:A, D, E
                                    分析:以MEMORY引擎建立的每张表都对应了一个以.frm为后缀的表定义文件。.MYI和.MYD对应的是以MyISAM引擎建立的的表的索引及数据文件。
                                    MEMORY引擎不支持外键,不支持事务,也不支持TEXT和BLOB类型列。表会在服务端重启时被清空,一般作为临时工作及从其他表抽取的只读数据存放地处理。


                                    参考:
                                    http://dev.mysql.com/doc/refman/5.6/en/memory-storage-engine.html


                                    回复
                                    28楼2015-11-19 11:22
                                      25


                                      Consider the MySQL Enterprise Audit plugin.
                                      The following event detail is found in the audit log:
                                      <AUDIT_RECORD
                                      TIMESTAMP="2013-04-09t01:54:17"
                                      NAME="Connect"
                                      CONNECTION_ID="3"
                                      STATUS="1045"
                                      USER="kate"
                                      PROXY_USER=""
                                      HOST="localhost"
                                      IP=""
                                      DB=""/>
                                      Which two points can be concluded from the given event?


                                      A.
                                      A connection was blocked by a firewall or a similar security mechanism.
                                      B.
                                      A connection was attempted via socket rather than TCP.
                                      C.
                                      A connection failed because the proxy user privileges did not match the login user.
                                      D.
                                      A connection as the user kate was successful.
                                      E.
                                      A connection failed due to authentication being unsuccessful.


                                      答案:B, E

                                      分析:
                                      首先对于localhost的本地连接,是使用socket连接方式,因此B正确。
                                      STATUS为1045,通过perror我们可以知道,报错为访问授权错误,说明可能登陆密码输入错误,这和防火墙没有关系,因此A错,E正确。


                                      C错,PROXY_USER为空值,索引请登陆并未使用proxy user。
                                      D错,STATUS为1045,因此访问是失败的,执行报错。
                                      参考:
                                      http://dev.mysql.com/doc/refman/5.7/en/connecting.html
                                      http://dev.mysql.com/doc/refman/5.7/en/audit-log-file.html
                                      http://dev.mysql.com/doc/refman/5.7/en/proxy-users.html


                                      回复
                                      29楼2015-11-22 21:35
                                        29


                                        Which statement is true about FLUSH LOGS command?
                                        A.
                                        It requires the RELOAD, FILE, and DROP privileges.
                                        B.
                                        It closes and reopens all log files.
                                        C.
                                        It closes and sends binary log files to slave servers.
                                        D.
                                        It flushes dirty pages in the buffer pool to the REDO logs.


                                        答案: B
                                        分析:A错,FLUSH 语法必须要有RELOAD权限,除此之外针对特定FLUSH语法还会要求有SELECT及LOCK TABLES权限。
                                        B正确,默认在不指定何种日志的情况下,会对所有日志进行关闭并开启新的日志。
                                        C错,此语句并不会将binary log发送到slave服务端。
                                        D错,对于innoDB引擎支持的表,FLUSH TABLES会将dirty pages从buffer pool中刷出到表数据文件中。
                                        参考:
                                        http://dev.mysql.com/doc/refman/5.7/en/flush.html


                                        回复
                                        32楼2015-11-29 17:08
                                          30


                                          Which two are correct steps in taking a binary backup of MyISAM tables?
                                          A.
                                          Always stop the server prior to the backup.
                                          B.
                                          Stop the server or lock the tables prior to the backup.
                                          C.
                                          Stop the server or lock the databases prior to the backup.
                                          D.
                                          Make a copy of the .frm, .myd, and the .myi files.
                                          E.
                                          Make a copy of the binary log and tablespace files.


                                          答案: B.D.
                                          分析:对于MyISAM引擎的表的binary备份,你可以先使用以下命令锁表:
                                          FLUSH TABLES tbl_list WITH READ LOCK;
                                          然后拷贝对应表的.frm,.myd和.myi文件来进行备份。因此A,C错,因为没有必要。E错,因为这是针对InnoDB引擎的表说的。
                                          参考:
                                          http://dev.mysql.com/doc/refman/5.6/en/backup-methods.html


                                          回复
                                          33楼2015-11-29 19:13
                                            31


                                            You want to start monitoring statistics on the distribution of storage engines that are being used and the average sizes of tables in the various databases.
                                            Some details are as follows:
                                            The MySQL instance has 400 databases. Each database on an average consists of 25-50 tables.
                                            You use the query:
                                            explain SELECT TABLE_SCHEMA,'ENGINE',COUNT(*),SUM(data_length) total_size
                                            FROM INFORMATION_SCHEMA.TABLES
                                            WHERE TABLE_TYPE='BASE TABLE'
                                            GROUP BY TABLE_SCHEMA, 'ENGINE';
                                            Why is this query slow to execute?


                                            A.
                                            Counting and summarizing all table pages in the InnoDB shared tablespace is time consuming.
                                            B.
                                            Collecting information requires various disk-level operations and is time consuming.
                                            C.
                                            Aggregating details from various storage engine caches for the final output is time consuming.
                                            D.
                                            Collecting information requires large numbers of locks on various INFORMATION_SCHEMA tables.


                                            答案: B
                                            分析:INFORMATION_SCHEMA数据库下的表都是虚拟表(可以看作是视图),它们都是通过收集各种对象信息动态生成的。
                                            其中INFORMATION_SCHEMA.TABLES表的信息查询,对于需要对底层文件进行scan操作因此尤其花时间。
                                            而通过explain此查询语句可知,此语句属于Open_full_table优化类(OPEN_FULL_TABLE: The unoptimized information lookup. The .frm, .MYD, and .MYI files must be opened.),
                                            由于并没有在where条件中对TABLE_SCHEMA及TABLE_NAME做任何常值限定,因此是做全库扫描,且对于每个表对应相关的物理文件也会打开扫描,因此性能会比较差。





                                            A错,INFORMATION_SCHEMA.TABLES表使用引擎为MEMORY,并非InnoDB。
                                            C错,数据收集完后的处理会在内存中进行,不会太花时间的。
                                            D错,这里只涉及到INFORMATION_SCHEMA.tables一张表,而且MEMORY引擎的表锁为表级锁,因此和表锁没关系,且也不会有很多锁这一说。


                                            参考:
                                            http://dev.mysql.com/doc/refman/5.7/en/information-schema.html
                                            http://dev.mysql.com/doc/refman/5.7/en/information-schema-optimization.html


                                            收起回复
                                            34楼2015-11-29 23:04
                                              32.


                                              Which two events will cause a slave server to create a new relay log file?


                                              A.
                                              Starting of the I/O thread
                                              B.
                                              Execution of the FLUSH LOGS statement
                                              C.
                                              Starting of the SQL thread
                                              D.
                                              Reaching the slave_pending_jobs_size_max limit
                                              E.
                                              Execution of FLUSH TABLES WITH READ LOCK


                                              答案:A,B
                                              分析:I/O thread是从Master读取到的SQL Event写入relay log, 然后SQL thread读取relay log后写入Slave。
                                              A slave server creates a new relay log file under the following conditions:
                                              1) Each time the I/O thread starts.
                                              2) When the logs are flushed; for example, with FLUSH LOGS or mysqladmin flush-logs.
                                              3) When the size of the current relay log file becomes “too large,” determined as follows:
                                              If the value of max_relay_log_size is greater than 0, that is the maximum relay log file size.
                                              If the value of max_relay_log_size is 0, max_binlog_size determines the maximum relay log file size.
                                              参考:
                                              http://dev.mysql.com/doc/refman/5.6/en/slave-logs-relaylog.html
                                              http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#sysvar_slave_pending_jobs_size_max


                                              回复
                                              36楼2015-12-01 11:47
                                                33.


                                                The InnoDB engine has a feature known as clustered indexes.
                                                Which three statements are true about clustered indexes as used in InnoDB?


                                                A.
                                                A primary key must exist for creation of a clustered index.
                                                B.
                                                A primary key is used as a clustered index.
                                                C.
                                                A clustered index is a grouping of indexes from different tables into a global index for faster
                                                searching.
                                                D.
                                                If no indexes exist, a hidden clustered index is generated based on row IDs.
                                                E.
                                                A clustered index provides direct access to a page containing row data.
                                                F.
                                                The first unique index is always used as a clustered index and not a primary key.
                                                G.
                                                A clustered index allows fulltext searching within InnoDB.


                                                答案:B, D, E
                                                分析:根据参考中的说明,clustered index的生成条件中,primary key不是必须的。如果不存在primary key和unique key,则其会自己会生成一个隐藏的clustered index。因此A错,D正确。
                                                C错,因为这不是作为多表的全局索引。F错,B正确,因为存在primary key的情况下,会首先将primary key作为clustered index。
                                                E说法正确。G错,因为fulltext search需要建立的是FULLTEXT索引,而全文索引是inverted index design.和clustered index不同。
                                                参考:
                                                http://dev.mysql.com/doc/refman/5.6/en/innodb-index-types.html
                                                http://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html


                                                回复
                                                37楼2015-12-01 13:35
                                                  34.


                                                  Which hardware storage option, when set up with redundant disks, offers the least stability, availability, and reliability for Mysql data?


                                                  A. RAID 5
                                                  B. iSCSI
                                                  C. SAN (Storage Area Network)
                                                  D. NFS (Networked File System)


                                                  答案:D
                                                  分析:参考文章中多次提到了NFS的许多缺点,不建议MySQL数据存放于NFS上。
                                                  If reliability is a consideration for your data, do not configure InnoDB to use data files or log files on NFS volumes.
                                                  Potential problems vary according to OS and version of NFS, and include such issues as lack of protection from conflicting writes, and limitations on maximum file sizes.


                                                  Even when the preceding precautions are observed, this kind of setup works only with MyISAM and MERGE tables, and not with any of the other storage engines.
                                                  Also, this warning against sharing a data directory among servers always applies in an NFS environment.
                                                  Permitting multiple MySQL servers to access a common data directory over NFS is a very bad idea.
                                                  The primary problem is that NFS is the speed bottleneck. It is not meant for such use.
                                                  Another risk with NFS is that you must devise a way to ensure that two or more servers do not interfere with each other.
                                                  Usually NFS file locking is handled by the lockd daemon, but at the moment there is no platform that performs locking 100% reliably in every situation.


                                                  It is not a good idea to configure InnoDB to use data files or log files on NFS volumes. Otherwise, the files might be locked by other processes and become unavailable for use by MySQL.


                                                  Do not put MySQL tables on an NFS-mounted volume.
                                                  NFS uses a message-passing protocol to write to files, which could cause data inconsistency if network messages are lost or received out of order.


                                                  参考:
                                                  http://dev.mysql.com/doc/refman/5.6/en/multiple-data-directories.html
                                                  http://dev.mysql.com/doc/refman/5.6/en/tablespace-placing.html
                                                  http://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html
                                                  http://dev.mysql.com/doc/refman/5.7/en/innodb-init-startup-configuration.html


                                                  回复
                                                  39楼2015-12-04 11:02
                                                    38


                                                    User A issues the command:
                                                    LOCK TABLES pet READ;
                                                    Which command can User B execute against the pet table?


                                                    A.
                                                    UPDATE pet…
                                                    B.
                                                    SELECT….FROM pet
                                                    C.
                                                    INSERT INTO pet…
                                                    D.
                                                    ALTER TABLE pet…


                                                    答案:B
                                                    分析:
                                                    READ锁:
                                                    1)获取此锁的会话可以读取锁对应的表(但是不能进行写操作)。
                                                    2)其他多个会话也可以在同时获取此表的READ锁。
                                                    3)其他会话可以在读取此表时不显式要求获取READ锁。
                                                    从以上说明中得出B正确,
                                                    由于UPDATE, INSERT, ALTER都会对表数据或表结构进行修改,因此在表被锁住的情况下,其他会话执行相关修改语句会hang住,因此A,C,D错。


                                                    session A:


                                                    session B:




                                                    参考:
                                                    http://dev.mysql.com/doc/refman/5.7/en/lock-tables.html
                                                    http://t.dbdao.com/archives/mysql-explicit-lock.html


                                                    回复
                                                    43楼2015-12-15 11:27
                                                      39.


                                                      When backing up a replication slave, which three should also be backed up in addition to data?
                                                      A.
                                                      The master.info and relay-log.info files
                                                      B.
                                                      The relay log files
                                                      C.
                                                      The relay index file
                                                      D.
                                                      mysql.slave_master_info table
                                                      E.
                                                      mysql.slave_relay_log_info table
                                                      F.
                                                      mysql.slave_worker_info table


                                                      答案:A,B,C
                                                      分析:如果对MySQL进行了设置,那么可以将相应master.info和relay-log.info状态信息文件中的信息存入mysql.slave_master_info和 mysql.slave_relay_log_info表中,但是题目中提到除了数据文件之外需要备份的文件。
                                                      这两个表实际上已经涵盖于数据文件中,因此此题目所指的其实是在其它的文件,D和E错误。那么(在非信息表存放的情况下)A首先是需要的,relay log文件也需要备份,因为恢复slave的时候也需要,B正确。当然如果slave过旧,也需要考虑master的binary log备份需要。
                                                      relay index文件存放的是当前可用的relay log文件,它和binary index文件的作用其实一样,如果没有这个文件,那么你的relay log文件都不会被你的slave所识别了,理论上也应该备份下,当然如果真没有备份的话,那么就需要你在恢复的时候手工新建这个文件,将relay log文件名加入到这个文件中了,因此C正确。
                                                      mysql.slave_worker_info表和备份方面无关,因此F错。
                                                      参考:
                                                      http://dev.mysql.com/doc/refman/5.7/en/replication-solutions-backups-rawdata.html
                                                      http://dev.mysql.com/doc/refman/5.7/en/slave-logs-relaylog.html
                                                      https://dev.mysql.com/doc/refman/5.6/en/slave-logs-status.html


                                                      回复
                                                      44楼2015-12-16 14:35
                                                        40.


                                                        You want to shutdown a running Mysql Server cleanly.
                                                        Which three commands that are valid on either Windows or Linux will achieve this?
                                                        A.
                                                        shell> pkill –u mysql mysqld_safe
                                                        B.
                                                        shell> service mysql safe_exit
                                                        C.
                                                        shell> /etc/init.d/mysql stop
                                                        D.
                                                        shell> mysqladmin –u root –p shutdown
                                                        E.
                                                        mysql> STOP PROCESS mysqld;
                                                        F.
                                                        shell> net stop mysql
                                                        G.
                                                        shell> nmc mysql shutdown


                                                        答案:CDF
                                                        分析:A错,pkill是可以杀进程,但是对符合模式匹配的进程,-u是找对应的有效用户id下进程,因此这种写法就是错误的。如果要关也应该写为pkill -15 mysqld。
                                                        查看/etc/init.d/mysql脚本逻辑(以Ubuntu版本MySQL为例)可知,关闭数据库的本质同样使用类似的kill命令:


                                                        B错,从UbuntuBootupHowto参考文档中,我们可以了解service命令是Upstart程序启动关闭服务所使用的命令,其实质继承了/etc/init.d中的服务脚本,而脚本设计规则一般使用的子命令为start, stop, status等,不存在safe_exit子命令。
                                                        同样从参考中我们可以了解C正确。
                                                        D正确,mysqladmin作为客户端工具,需要登录后才能执行之后的子命令,而shutdown正是mysqladmin作为MySQL数据库管理工具关闭数据库的操作子命令。
                                                        E和G错,无此命令。
                                                        F正确,当MySQL server以Windows服务进行了注册,就可以使用net命令来对服务进行启动关闭(注意使用net命令需要使用以管理员身份打开的CMD窗口)。


                                                        参考:
                                                        https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/pkill.1.html
                                                        http://unix.stackexchange.com/questions/20357/how-can-i-make-a-script-in-etc-init-d-start-at-boot
                                                        http://www.oreilly.com/openbook/debian/book/ch07_03.html
                                                        https://help.ubuntu.com/community/UbuntuBootupHowto
                                                        http://dev.mysql.com/doc/refman/5.7/en/mysqladmin.html
                                                        http://dev.mysql.com/doc/refman/5.7/en/windows-start-service.html


                                                        回复
                                                        46楼2015-12-18 13:45
                                                          41.
                                                          What are two methods of taking a binary backup of a Mysql Server using InnoDB storage engine?


                                                          A.
                                                          MySQL Enterprise Backup
                                                          B.
                                                          mysqldump with –-binary-data option
                                                          C.
                                                          mysqlhotcopy
                                                          D.
                                                          File system snapshots
                                                          E.
                                                          mysqldumpslow
                                                          -------------------------
                                                          答案:AD
                                                          分析:
                                                          A正确,因为此为企业级MySQL热备工具,且进行的是物理备份,支持InnoDB存储引擎表的备份。
                                                          B错,无此参数项,且mysqldump是用于做逻辑备份的。E错,因为mysqldumpslow是对MySQL Slow Query Log的解析和归总。
                                                          C错,mysqlhotcopy可用于备份MyISAM和ARCHIVE存储引擎表,其内部使用cp和scp命令来进行文件拷贝备份,虽然是二进制备份,但是并非是针对InnoDB表的备份,需要注意的是此工具从MySQL 5.6.20开始被过气,在MySQL 5.7中被完全移除了。
                                                          D正确,文件系统快照(File system snapshots),这是许多大企业选择的方案,因为系统级的快照速度很快,且可作为二进制备份。
                                                          参考:
                                                          http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html
                                                          http://dev.mysql.com/doc/refman/5.6/en/mysqlhotcopy.html
                                                          http://dev.mysql.com/doc/refman/5.7/en/mysqldumpslow.html
                                                          http://dev.mysql.com/doc/refman/5.6/en/backup-methods.html


                                                          回复
                                                          47楼2015-12-21 14:32
                                                            42.


                                                            Consider the following table:
                                                            CREATE TABLE games(id int (10) unsigned NOT NULL AUTO_INCREMENT,
                                                            keyword varchar (45) DEFAULT NULL,
                                                            date datetime NOT NULL,
                                                            PRIMARY KEY (id, date),
                                                            UNIQUE KEY keyword_idx(keyword, date)
                                                            ) ENGINE=InnoDB DEFAULT CHARSET=latin1
                                                            PARTITION BY RANGE (TO_DAYS(date))(
                                                            PARTITION g201301 VALUES LESS THAN (TO_DAYS('2013-01-01 00:00:00')),
                                                            PARTITION g201302 VALUES LESS THAN (TO_DAYS('2013-02-01 00:00:00')),
                                                            PARTITION g201303 VALUES LESS THAN (TO_DAYS('2013-03-01 00:00:00')),
                                                            PARTITION g201304 VALUES LESS THAN (TO_DAYS('2013-04-01 00:00:00')),
                                                            PARTITION gMORES VALUES LESS THAN (MAXVALUE));






                                                            Which method should be used to add a new g201305 partition to the table?


                                                            A.
                                                            ALTER TABLE games
                                                            REORGANIZE PARTITION gMORES INTO (
                                                            PARTITION g201305 VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00')),
                                                            PARTITION gMORES VALUES LESS THAN (MAXVALUE)
                                                            );
                                                            B.
                                                            ALTER TABLE games
                                                            ADD PARTITION g201350 VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00'));
                                                            C.
                                                            ALTER TABLE games COALESCE PARTITION gMORES INTO
                                                            PARTITION g201305 VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00')),
                                                            PARTITION gMORES VALUES LESS THAN (MAXVALUE));
                                                            D.
                                                            ALTER TABLE games
                                                            SPLIT PARTITION gMORES INTO (
                                                            PARTITION g201305 VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00')),
                                                            PARTITION gMORES VALUES LESS THAN (MAXVALUE)
                                                            );
                                                            E.
                                                            ALTER TABLE games
                                                            DROP PARTITION gMORES,
                                                            ADD PARTITION (
                                                            PARTITION g201305 VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00')),
                                                            PARTITION gMORES VALUES LESS THAN (MAXVALUE));


                                                            答案:A
                                                            分析:由于在表分区定义时,已经定义了MAXVALUE的存放分区,而ADD PARTITION在设置时必须值更大于MAXVALUE,这显然是不可能的,因此B错。
                                                            在对已存分区进行重新分区时,没有SPLIT PARTITION这种语法,而使用的REORGANIZE PARTITION partition_names INTO (partition_definitions)这样的语法,因此D错,A正确。
                                                            对于COALESCE PARTITION语法,主要用于控制HASH或KEY的自动分区数量,并无对特定种分区进行的分区语法,C错。
                                                            从参考中,我们知道ADD PARTITION, DROP PARTITION, COALESCE PARTITION, REORGANIZE PARTITION, ANALYZE PARTITION, CHECK PARTITION, and REPAIR PARTITION options cannot be combined with other alter specifications in a single ALTER TABLE, since the options just listed act on individual partitions.
                                                            即一个ALTER TABLE语法中,不可同时进行这些操作,需要分开执行,因此E错,如果分开执行就可成功。




                                                            参考:
                                                            http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
                                                            http://dev.mysql.com/doc/refman/5.6/en/alter-table-partition-operations.html
                                                            http://dev.mysql.com/doc/refman/5.6/en/partitioning-management-range-list.html


                                                            收起回复
                                                            49楼2015-12-22 18:06