config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/t/connection_unixsocket.test

## UNIX Socket connections

## Preamble
--source include/not_windows.inc
--source ../include/have_performance_schema_threads.inc
--source ../include/xplugin_preamble.inc

CREATE USER user_127_0_0_1@127.0.0.1 IDENTIFIED WITH 'mysql_native_password' BY '';
CREATE USER user_8_8_8_8@8.8.8.8 IDENTIFIED WITH 'mysql_native_password' BY '';
CREATE USER user_all@'%' IDENTIFIED WITH 'mysql_native_password' BY '';
CREATE USER user_localhost@localhost IDENTIFIED WITH 'mysql_native_password' BY '';
CREATE USER user_localhost_8_8_8_8@localhost IDENTIFIED WITH 'mysql_native_password' BY '';
CREATE USER user_localhost_8_8_8_8@8.8.8.8 IDENTIFIED WITH 'mysql_native_password' BY '';

GRANT ALL ON *.* TO user_127_0_0_1@127.0.0.1;
GRANT ALL ON *.* TO user_8_8_8_8@8.8.8.8;
GRANT ALL ON *.* TO user_all@'%';
GRANT ALL ON *.* TO user_localhost@localhost;
GRANT ALL ON *.* TO user_localhost_8_8_8_8@8.8.8.8;
GRANT ALL ON *.* TO user_localhost_8_8_8_8@localhost;

CREATE TABLE `city` (
  `ID` int(11) NOT NULL auto_increment,
  `Name` char(35) NOT NULL default '',
  `CountryCode` char(3) NOT NULL default '',
  `District` char(20) NOT NULL default '',
  `Population` int(11) NOT NULL default '0',
  PRIMARY KEY  (`ID`)
);
INSERT INTO `city` VALUES (1,'Kabul','AFG','Kabol',1780);
INSERT INTO `city` VALUES (2,'Qandahar','AFG','Qandahar',237);
INSERT INTO `city` VALUES (3,'Herat','AFG','Herat',186);
INSERT INTO `city` VALUES (4,'Mazar-e-Sharif','AFG','Balkh',127);
INSERT INTO `city` VALUES (5,'Amsterdam','NLD','Noord-Holland',731);
INSERT INTO `city` VALUES (6,'Rotterdam','NLD','Zuid-Holland',593);

call mtr.add_suppression("Plugin mysqlx reported: '1.1: Unsuccessful login attempt: Invalid user or password'");
call mtr.add_suppression("Plugin mysqlx reported: '2.1: Unsuccessful login attempt: Invalid user or password'");

## Test starts here
--write_file $MYSQL_TMP_DIR/basic_connection.tmp
## Test data

# Test plan 1.1.4.1
Mysqlx.Sql.StmtExecute {
  stmt: "ping"
  namespace: "mysqlx"
}

## expect Mysqlx.Sql.StmtExecuteOk
-->recvresult

-->stmtsql SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query';
-->recvresult

Mysqlx.Crud.Find {
  collection {
    name: "city"
    schema: "test"
  }
  data_model: TABLE
  criteria {
    type: OPERATOR
    operator {
      name: "<"
      param {
        type: IDENT
        identifier {
          name: "Population"
        }
      }
      param {
        type: LITERAL
        literal {
          type: V_SINT
          v_signed_int: 250
        }
      }
    }
  }
}
-->recvresult

EOF

# Server was started with UNIX socket support
# Check if UNIX socket file and lock file exist
--file_exists $MASTER_X_MYSOCK
--file_exists $MASTER_X_MYSOCK.lock

--let $expected_error_msg= Invalid user or password \(code 1045\)
--source ../include/mysqlxtest_expected_error.inc
--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uuser_127_0_0_1 --password='' --file=$MYSQL_TMP_DIR/basic_connection.tmp 2>&1

--let $expected_error_msg= Invalid user or password \(code 1045\)
--source ../include/mysqlxtest_expected_error.inc
--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uuser_8_8_8_8 --password='' --file=$MYSQL_TMP_DIR/basic_connection.tmp 2>&1

--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uuser_all --password='' --file=$MYSQL_TMP_DIR/basic_connection.tmp 2>&1

--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uuser_localhost --password='' --file=$MYSQL_TMP_DIR/basic_connection.tmp 2>&1

--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uuser_localhost_8_8_8_8 --password='' --file=$MYSQL_TMP_DIR/basic_connection.tmp 2>&1

--echo Check if mysqlx_socket has correct value
--disable_query_log
--eval select @@mysqlx_socket like "$MASTER_X_MYSOCK" as 'result';
--enable_query_log

--write_file $MYSQL_TMP_DIR/parallel_connections.tmp
## Test data

#Ensure that each of following uses UNIX Socket
-->stmtsql SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query';
-->recvresult

-->newsession session2	root
-->stmtsql SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query';
-->recvresult

-->newsession session3	root
-->stmtsql SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query';
-->recvresult

#Do query in parallel
-->setsession session3
-->stmtsql select '3_1';
-->setsession session2
-->stmtsql select '2_1';
-->setsession
-->stmtsql select '1_1';

-->setsession session2
#-->stmtsql select '2_1';
-->recvresult

-->setsession session3
#-->stmtsql select '3_1';
-->recvresult

-->setsession
#-->stmtsql select '1_1';
-->recvresult

EOF

--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uroot --password='' --file=$MYSQL_TMP_DIR/parallel_connections.tmp 2>&1


--write_file $MYSQL_TMP_DIR/plain_connection.tmp

-->echo #
-->echo # Match capabilities with the result file,
-->echo # must contain PLAIN and MYSQL41
-->echo #
Mysqlx.Connection.CapabilitiesGet {
}
-->recv capabilities[0].value.array

-->echo #
-->echo # Do plain authentication (must be available)
-->echo #
Mysqlx.Session.AuthenticateStart {
    mech_name: "PLAIN"
    auth_data: "\0root\0"
}
-->recvuntil Mysqlx.Session.AuthenticateOk do_not_show_intermediate
EOF

--exec $MYSQLXTEST -q -n --socket=$MASTER_X_MYSOCK -uroot --password='' --file=$MYSQL_TMP_DIR/plain_connection.tmp 2>&1


--echo #
--echo # Lets confirm that user can connect through UNIX socket connection is secure one
--echo #
SET GLOBAL require_secure_transport:=1;
--exec $MYSQLXTEST --socket=$MASTER_X_MYSOCK -uroot --password='' --file=$MYSQL_TMP_DIR/basic_connection.tmp 2>&1
--exec $MYSQLXTEST -q -n --socket=$MASTER_X_MYSOCK -uroot --password='' --file=$MYSQL_TMP_DIR/plain_connection.tmp 2>&1
SET GLOBAL require_secure_transport:=0;

#
--write_file $MYSQL_TMP_DIR/check_unixsocket.tmp
-->stmtsql SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query';
-->recvresult
EOF

# Command line option --mysqlx-socket
--replace_regex /mysqlx-socket=.*sock/mysqlx-socket=SOCKET/
let $restart_parameters = restart: --mysqlx-socket=$MYSQL_TMP_DIR/valid_mysqlx.sock;
--source ../include/restart_mysqld_and_wait_for_xplugin.inc

# MySQL Server was started with new UNIX socket file for X Plugin
# Check if old UNIX socket file was removed and lockfile
--error 1
--file_exists $MASTER_X_MYSOCK
--error 1
--file_exists $MASTER_X_MYSOCK.lock

# Check if the X Plugin is accessible through
# new file
--exec $MYSQLXTEST --socket=$MYSQL_TMP_DIR/valid_mysqlx.sock -uroot --password='' --file=$MYSQL_TMP_DIR/check_unixsocket.tmp 2>&1

## Postamble
--remove_file $MYSQL_TMP_DIR/basic_connection.tmp
--remove_file $MYSQL_TMP_DIR/parallel_connections.tmp
--remove_file $MYSQL_TMP_DIR/plain_connection.tmp
--remove_file $MYSQL_TMP_DIR/check_unixsocket.tmp

DROP TABLE `city`;
DROP USER user_127_0_0_1@127.0.0.1,user_8_8_8_8@8.8.8.8, user_all@'%', user_localhost@localhost, user_localhost_8_8_8_8@8.8.8.8, user_localhost_8_8_8_8@localhost;
UNINSTALL PLUGIN mysqlx;

Man Man