summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.cvsignore15
-rw-r--r--[-rwxr-xr-x]scripts/CMakeLists.txt395
-rw-r--r--scripts/Makefile.am198
-rwxr-xr-xscripts/dheadgen.pl338
-rw-r--r--scripts/make_binary_distribution.sh396
-rw-r--r--scripts/make_sharedlib_distribution.sh136
-rwxr-xr-xscripts/make_win_bin_dist31
-rw-r--r--scripts/mysql_config.pl.in8
-rw-r--r--scripts/mysql_config.sh31
-rw-r--r--scripts/mysql_fix_privilege_tables.sh223
-rw-r--r--scripts/mysql_install_db.sh10
-rw-r--r--scripts/mysql_system_tables.sql403
-rw-r--r--scripts/mysql_system_tables_data.sql16
-rw-r--r--scripts/mysql_system_tables_fix.sql90
-rwxr-xr-x[-rw-r--r--]scripts/mysqlaccess.conf0
-rw-r--r--scripts/mysqld_multi.sh24
-rw-r--r--scripts/mysqld_safe.sh177
-rw-r--r--scripts/mysqlhotcopy.sh59
18 files changed, 1526 insertions, 1024 deletions
diff --git a/scripts/.cvsignore b/scripts/.cvsignore
deleted file mode 100644
index b8444752a0d..00000000000
--- a/scripts/.cvsignore
+++ /dev/null
@@ -1,15 +0,0 @@
-Makefile
-Makefile.in
-make_binary_distribution
-msql2mysql
-mysql_config
-mysql_convert_table_format
-mysql_find_rows
-mysql_fix_privilege_tables
-mysql_install_db
-mysql_setpermission
-mysql_zap
-mysqlaccess
-mysqlbug
-mysqlhotcopy
-safe_mysqld
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index f0db25be79a..2efb348fcd5 100755..100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -11,67 +11,362 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# Build mysql_fix_privilege_tables.sql
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql
- COMMAND copy /b
- mysql_system_tables.sql + mysql_system_tables_fix.sql
- mysql_fix_privilege_tables.sql
- DEPENDS
- ${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables.sql
- ${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables_fix.sql)
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Build comp_sql - used for embedding SQL in C or C++ programs
-ADD_EXECUTABLE(comp_sql comp_sql.c)
-TARGET_LINK_LIBRARIES(comp_sql debug dbug mysys strings)
+IF(NOT CMAKE_CROSSCOMPILING)
+ ADD_EXECUTABLE(comp_sql comp_sql.c)
+ TARGET_LINK_LIBRARIES(comp_sql)
+ENDIF()
+
-# Use comp_sql to build mysql_fix_privilege_tables_sql.c
-GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION)
+# Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts)
+IF(NOT WIN32 OR CMAKE_CROSSCOMPILING)
+ FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable")
+ MARK_AS_ADVANCED(CAT_EXECUTABLE)
+ENDIF()
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c
- COMMAND ${COMP_SQL_EXE}
- mysql_fix_privilege_tables
- mysql_fix_privilege_tables.sql
- mysql_fix_privilege_tables_sql.c
- DEPENDS comp_sql ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables.sql)
+IF(CAT_EXECUTABLE)
+ SET(CAT_COMMAND COMMAND
+ ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql >
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
+ )
+ELSEIF(WIN32)
+ FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
+ native_outfile )
+ SET(CAT_COMMAND
+ COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
+ cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql
+ ${native_outfile} )
+ELSE()
+ MESSAGE(FATAL_ERROR "Cannot concatenate files")
+ENDIF()
-# Add dummy target for the above to be built
+# Build mysql_fix_privilege_tables.c
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables_sql.c
+ ${CAT_COMMAND}
+ COMMAND comp_sql
+ mysql_fix_privilege_tables
+ mysql_fix_privilege_tables.sql
+ mysql_fix_privilege_tables_sql.c
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS comp_sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql
+)
+
+# Add target for the above to be built
ADD_CUSTOM_TARGET(GenFixPrivs
- ALL
- DEPENDS ${PROJECT_SOURCE_DIR}/scripts/mysql_fix_privilege_tables_sql.c)
+ ALL
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables_sql.c
+)
+
+IF(UNIX)
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution
+ "cd ${CMAKE_BINARY_DIR} && '${CMAKE_CPACK_COMMAND}' -G TGZ --config CPackConfig.cmake" )
+ EXECUTE_PROCESS(
+ COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/make_binary_distribution
+)
+ENDIF()
+
+INSTALL(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
+ ${FIX_PRIVILEGES_SQL}
+ DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server
+)
+
+# TCMalloc hacks
+IF(MALLOC_LIB)
+ MESSAGE("Using tcmalloc '${MALLOC_LIB}'")
+ INSTALL(FILES ${MALLOC_LIB} DESTINATION ${INSTALL_LIBDIR} OPTIONAL)
+ENDIF()
+
+IF(CMAKE_GENERATOR MATCHES "Makefiles")
+ # Strip maintainer mode options if necessary
+ STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+ STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ FOREACH(ARCH ${CMAKE_OSX_ARCHITECTURES})
+ SET(CFLAGS "${CFLAGS} -arch ${ARCH}")
+ SET(CXXFLAGS "${CXXFLAGS} -arch ${ARCH}")
+ ENDFOREACH()
+ELSE()
+ # Strip maintainer mode options if necessary
+ STRING(REPLACE "${MY_MAINTAINER_C_WARNINGS}" "" CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
+ STRING(REPLACE "${MY_MAINTAINER_CXX_WARNINGS}" "" CXXFLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+ENDIF()
+
+IF(UNIX)
+ # FIND_PROC and CHECK_PID are used by mysqld_safe
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET (FIND_PROC
+ "ps wwwp $PID | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null")
+ENDIF()
+IF(NOT FIND_PROC AND CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ SET (FIND_PROC
+ "ps -p $PID | grep -v mysqld_safe | grep -- $MYSQLD > /dev/null")
+ENDIF()
+
+IF(NOT FIND_PROC)
+ # BSD style
+ EXECUTE_PROCESS(COMMAND ps -uaxww OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
+ IF(result MATCHES 0)
+ SET( FIND_PROC
+ "ps -uaxww | grep -v mysqld_safe | grep -- $MYSQLD | grep $PID > /dev/null")
+ ENDIF()
+ENDIF()
+
+IF(NOT FIND_PROC)
+ # SysV style
+ EXECUTE_PROCESS(COMMAND ps -ef OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
+ IF(result MATCHES 0)
+ SET( FIND_PROC "ps -ef | grep -v mysqld_safe | grep -- $MYSQLD | grep $PID > /dev/null")
+ ENDIF()
+ENDIF()
+
+EXECUTE_PROCESS(COMMAND sh -c "kill -0 $$" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
+IF(result MATCHES 0)
+ SET(CHECK_PID "kill -0 $PID > /dev/null 2> /dev/null")
+ELSE()
+ SET(CHECK_PID "kill -s SIGCONT $PID > /dev/null 2> /dev/null")
+ENDIF()
+
+SET(HOSTNAME "hostname")
+SET(MYSQLD_USER "mysql")
+
+# Required for mysqlbug until autotools are deprecated, once done remove these
+# and expand default cmake variables
+SET(CC ${CMAKE_C_COMPILER})
+SET(CXX ${CMAKE_CXX_COMPILER})
+SET(SAVE_CC ${CMAKE_C_COMPILER})
+SET(SAVE_CXX ${CMAKE_CXX_COMPILER})
+SET(SAVE_CFLAGS ${CFLAGS})
+SET(SAVE_CXXFLAGS ${CXXFLAGS})
+# XXX no cmake equivalent for this, just make one up
+SET(CONFIGURE_LINE "Built using CMake")
+
+# Also required for mysqlbug, autoconf only supports --version so for now we
+# just explicitly require GNU
+IF(CMAKE_COMPILER_IS_GNUCC)
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ OUTPUT_VARIABLE CC_VERSION)
+ELSE()
+ SET(CC_VERSION "")
+ENDIF()
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
+ COMMAND sed 1q
+ OUTPUT_VARIABLE CXX_VERSION)
+ELSE()
+ SET(CXX_VERSION "")
+ENDIF()
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY)
+INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/mysqlbug
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT Server
+ )
+
+ENDIF(UNIX)
+
+# Really ugly, one script, "mysql_install_db", needs prefix set to ".",
+# i.e. makes access relative the current directory. This matches
+# the documentation, so better not change this.
+
+IF(INSTALL_LAYOUT MATCHES "STANDALONE")
+ SET(prefix ".")
+ELSE()
+ SET(prefix "${CMAKE_INSTALL_PREFIX}")
+ENDIF()
+
+SET(bindir ${prefix}/${INSTALL_BINDIR})
+SET(sbindir ${prefix}/${INSTALL_SBINDIR})
+SET(scriptdir ${prefix}/${INSTALL_BINDIR})
+SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+IF(INSTALL_LAYOUT MATCHES "STANDALONE")
+ SET(localstatedir ${prefix}/data)
+ELSE()
+ SET(localstatedir ${MYSQL_DATADIR})
+ENDIF()
+
+IF(UNIX)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY)
+ SET(DEST ${INSTALL_SCRIPTDIR})
+ SET(EXT)
+ELSE()
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.pl.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db.pl ESCAPE_QUOTES @ONLY)
+ SET(DEST ${INSTALL_SCRIPTDIR})
+ SET(EXT ".pl")
+ENDIF()
+
+INSTALL_SCRIPT(
+ "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db${EXT}"
+ DESTINATION ${DEST}
+ COMPONENT Server
+ )
+
+
+SET(prefix "${CMAKE_INSTALL_PREFIX}")
+SET(sysconfdir ${prefix})
+SET(bindir ${prefix}/${INSTALL_BINDIR})
+SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+SET(scriptdir ${prefix}/${INSTALL_BINDIR})
+SET(datadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
+SET(pkglibdir ${prefix}/${INSTALL_LIBDIR})
+SET(pkgplugindir ${prefix}/${INSTALL_PLUGINDIR})
+SET(localstatedir ${MYSQL_DATADIR})
+
+# some scripts use @TARGET_LINUX@
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET(TARGET_LINUX "true")
+ELSE()
+ SET(TARGET_LINUX "false")
+ENDIF()
+
+# Use cmake variables to inspect dependencies for
+# mysqlclient library (add -l stuff)
+SET(CLIENT_LIBS "")
+SET(LIBS "")
+
+# Avoid compatibility warning about lists with empty elements
+IF(POLICY CMP0011)
+ CMAKE_POLICY(SET CMP0011 NEW)
+ENDIF()
+IF(POLICY CMP0007)
+ CMAKE_POLICY(SET CMP0007 OLD)
+ENDIF()
+
+# Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable
+# returned string in ${var} is can be passed to linker's command line
+MACRO(EXTRACT_LINK_LIBRARIES target var)
+ IF(${target}_LIB_DEPENDS)
+ LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "")
+ LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS)
+ FOREACH(lib ${${target}_LIB_DEPENDS})
+ # Filter out "general", it is not a library, just CMake hint
+ # Also, remove duplicates
+ IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ")
+ IF (lib MATCHES "^\\-l")
+ SET(${var} "${${var}} ${lib} ")
+ ELSEIF(lib MATCHES "^/")
+ # Full path, convert to just filename, strip "lib" prefix and extension
+ GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE)
+ STRING(REGEX REPLACE "^lib" "" lib "${lib}")
+ SET(${var} "${${var}}-l${lib} " )
+ ELSE()
+ SET(${var} "${${var}}-l${lib} " )
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
+ ENDIF()
+ IF(MSVC)
+ STRING(REPLACE "-l" "" ${var} "${${var}}")
+ ENDIF()
+ENDMACRO()
+
+EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)
+EXTRACT_LINK_LIBRARIES(mysqlserver LIBS)
-# ----------------------------------------------------------------------
-# Replace some variables @foo@ in the .in/.sh file, and write the new script
-# ----------------------------------------------------------------------
+# mysql_config evaluates ${LIBDL}, we want to avoid it
+# as our CLIENT_LIBS and LIBS are already correct
+SET(LIBDL)
-SET(CFLAGS "-D_WINDOWS ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
-SET(prefix "${CMAKE_INSTALL_PREFIX}/MySQL Server ${MYSQL_BASE_VERSION}")
-SET(sysconfdir ${prefix})
-SET(bindir ${prefix}/bin)
-SET(libexecdir ${prefix}/bin)
-SET(scriptdir ${prefix}/bin)
-SET(datadir ${prefix}/share)
-SET(pkgdatadir ${prefix}/share)
-SET(localstatedir ${prefix}/data)
+SET(NON_THREADED_LIBS ${CLIENT_LIBS})
+SET(mysql_config_COMPONENT COMPONENT Development)
-CONFIGURE_FILE(mysql_config.pl.in
- scripts/mysql_config.pl ESCAPE_QUOTES @ONLY)
+IF(WIN32)
+ # On Windows, some .sh and some .pl.in files are configured
+ # The resulting files will have .pl extension (those are perl scripts)
-CONFIGURE_FILE(mysql_convert_table_format.sh
- scripts/mysql_convert_table_format.pl ESCAPE_QUOTES @ONLY)
+ # Input files with pl.in extension
+ SET(PLIN_FILES mysql_config mysql_secure_installation)
+ # Input files with .sh extension
-CONFIGURE_FILE(mysql_install_db.pl.in
- scripts/mysql_install_db.pl ESCAPE_QUOTES @ONLY)
+ SET(SH_FILES mysql_convert_table_format mysqld_multi mysqldumpslow
+ mysqlhotcopy)
-CONFIGURE_FILE(mysql_secure_installation.pl.in
- scripts/mysql_secure_installation.pl ESCAPE_QUOTES @ONLY)
+ FOREACH(file ${PLIN_FILES})
+ IF(NOT ${file}_COMPONENT)
+ SET(${file}_COMPONENT Server_Scripts)
+ ENDIF()
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.pl.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
+ INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT ${${file}_COMPONENT})
+ ENDFOREACH()
-CONFIGURE_FILE(mysqld_multi.sh
- scripts/mysqld_multi.pl ESCAPE_QUOTES @ONLY)
+ FOREACH(file ${SH_FILES})
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
+ INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/${file}.pl COMPONENT Server_Scripts)
+ ENDFOREACH()
+ELSE()
+ # On Unix, most of the files end up in the bin directory
+ SET(mysql_config_COMPONENT COMPONENT Development)
+ SET(BIN_SCRIPTS
+ msql2mysql
+ mysql_config
+ mysql_fix_extensions
+ mysql_setpermission
+ mysql_secure_installation
+ mysql_zap
+ mysqlaccess
+ mysqlaccess.conf
+ mysql_convert_table_format
+ mysql_find_rows
+ mysqlhotcopy
+ mysqldumpslow
+ mysqld_multi
+ mysqld_safe
+ )
+ FOREACH(file ${BIN_SCRIPTS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} COPYONLY)
+ ELSE()
+ MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
+ "${CMAKE_CURRENT_SOURCE_DIR}" )
+ ENDIF()
+ EXECUTE_PROCESS(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${file})
+ IF(NOT ${file}_COMPONENT)
+ SET(${file}_COMPONENT Server)
+ ENDIF()
+ INSTALL_SCRIPT(
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT ${${file}_COMPONENT}
+ )
+ ENDFOREACH()
+ENDIF()
-CONFIGURE_FILE(mysqldumpslow.sh
- scripts/mysqldumpslow.pl ESCAPE_QUOTES @ONLY)
+# Install libgcc as mylibgcc.a
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
+ EXECUTE_PROCESS (
+ COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}
+ ${CMAKE_CXX_FLAGS} --print-libgcc
+ OUTPUT_VARIABLE LIBGCC_LOCATION
+ RESULT_VARIABLE RESULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET
+ )
+ IF(${RESULT} EQUAL 0 AND EXISTS ${LIBGCC_LOCATION})
+ INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION ${INSTALL_LIBDIR}
+ COMPONENT Development)
+ ENDIF()
+ENDIF()
-CONFIGURE_FILE(mysqlhotcopy.sh
- scripts/mysqlhotcopy.pl ESCAPE_QUOTES @ONLY)
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
deleted file mode 100644
index 82e0535edee..00000000000
--- a/scripts/Makefile.am
+++ /dev/null
@@ -1,198 +0,0 @@
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-## Process this file with automake to create Makefile.in
-
-BUILT_SOURCES = mysql_fix_privilege_tables.sql \
- mysql_fix_privilege_tables_sql.c
-
-EXTRA_PROGRAMS = comp_sql
-
-bin_SCRIPTS = @server_scripts@ \
- msql2mysql \
- mysql_config \
- mysql_fix_privilege_tables \
- mysql_fix_extensions \
- mysql_setpermission \
- mysql_secure_installation \
- mysql_zap \
- mysqlaccess \
- mysqlbug \
- mysql_convert_table_format \
- mysql_find_rows \
- mysqlhotcopy \
- mysqldumpslow \
- mysqld_multi
-
-noinst_SCRIPTS = make_binary_distribution \
- make_sharedlib_distribution
-
-EXTRA_SCRIPTS = make_binary_distribution.sh \
- make_sharedlib_distribution.sh \
- msql2mysql.sh \
- mysql_config.sh \
- mysql_config.pl.in \
- mysql_fix_privilege_tables.sh \
- mysql_fix_extensions.sh \
- mysql_install_db.sh \
- mysql_install_db.pl.in \
- mysql_setpermission.sh \
- mysql_secure_installation.sh \
- mysql_secure_installation.pl.in \
- mysql_zap.sh \
- mysqlaccess.sh \
- mysqlbug.sh \
- mysql_convert_table_format.sh \
- mysql_find_rows.sh \
- mysqlhotcopy.sh \
- mysqldumpslow.sh \
- mysqld_multi.sh \
- mysqld_safe.sh
-
-EXTRA_DIST = $(EXTRA_SCRIPTS) \
- mysqlaccess.conf \
- mysqlbug \
- make_win_bin_dist \
- mysql_fix_privilege_tables_sql.c \
- mysql_system_tables_fix.sql \
- CMakeLists.txt
-
-dist_pkgdata_DATA = fill_help_tables.sql \
- mysql_fix_privilege_tables.sql \
- mysql_system_tables.sql \
- mysql_system_tables_data.sql \
- mysql_test_data_timezone.sql
-
-CLEANFILES = @server_scripts@ \
- make_binary_distribution \
- make_sharedlib_distribution \
- msql2mysql \
- mysql_config \
- mysql_fix_privilege_tables \
- mysql_fix_extensions \
- mysql_setpermission \
- mysql_secure_installation \
- mysql_zap \
- mysqlaccess \
- mysql_convert_table_format \
- mysql_find_rows \
- mysqlhotcopy \
- mysqldumpslow \
- mysqld_multi
-
-pkgplugindir = $(pkglibdir)/plugin
-
-# Default same as 'pkgdatadir', but we can override it
-pkgsuppdir = $(datadir)/@PACKAGE@
-
-# mysqlbug should be distributed built so that people can report build
-# failures with it.
-DISTCLEANFILES = $(BUILT_SOURCES) mysqlbug
-
-# We want the right version and configure comand line in mysqlbug
-mysqlbug: ${top_builddir}/config.status mysqlbug.sh
-
-# Build mysql_fix_privilege_tables.sql from the files that contain
-# the system tables for this version of MySQL plus any commands
-# needed to upgrade the system tables from an older version
-mysql_fix_privilege_tables.sql: mysql_system_tables.sql \
- mysql_system_tables_fix.sql
- @echo "Building $@";
- @cat mysql_system_tables.sql mysql_system_tables_fix.sql > $@
-
-#
-# Build mysql_fix_privilege_tables_sql.c from
-# mysql_fix_privileges_tables.sql using comp_sql
-# The "sleep" ensures the generated file has a younger timestamp than its source
-# (which may have been generated in this very same "make" run).
-#
-mysql_fix_privilege_tables_sql.c: comp_sql.c mysql_fix_privilege_tables.sql
- $(MAKE) $(AM_MAKEFLAGS) comp_sql$(EXEEXT)
- sleep 2
- $(top_builddir)/scripts/comp_sql$(EXEEXT) \
- mysql_fix_privilege_tables \
- $(top_srcdir)/scripts/mysql_fix_privilege_tables.sql $@
-
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''sbindir''@!$(sbindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''pkglibdir''@!$(pkglibdir)!g' \
- -e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \
- -e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \
- -e 's!@''pkgplugindir''@!$(pkgplugindir)!g' \
- -e 's!@''pkgsuppdir''@!$(pkgsuppdir)!g' \
- -e 's!@''sysconfdir''@!$(sysconfdir)!g' \
- -e 's!@''mandir''@!$(mandir)!g' \
- -e 's!@''infodir''@!$(infodir)!g' \
- -e 's!@''CC''@!@CC@!'\
- -e 's!@''CXX''@!@CXX@!'\
- -e 's!@''GXX''@!@GXX@!'\
- -e 's!@''SAVE_CC''@!@SAVE_CC@!'\
- -e 's!@''SAVE_CXX''@!@SAVE_CXX@!'\
- -e 's!@''CC_VERSION''@!@CC_VERSION@!'\
- -e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''SAVE_ASFLAGS''@!@SAVE_ASFLAGS@!'\
- -e 's!@''SAVE_CFLAGS''@!@SAVE_CFLAGS@!'\
- -e 's!@''SAVE_CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
- -e 's!@''SAVE_LDFLAGS''@!@SAVE_LDFLAGS@!'\
- -e 's!@''ASFLAGS''@!@ASFLAGS@!'\
- -e 's!@''CFLAGS''@!@CFLAGS@!'\
- -e 's!@''CXXFLAGS''@!@CXXFLAGS@!'\
- -e 's!@''LDFLAGS''@!@LDFLAGS@!'\
- -e 's!@''LIBDL''@!@LIBDL@!'\
- -e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \
- -e 's!@''ZLIB_LIBS''@!@ZLIB_LIBS@!' \
- -e 's!@''LIBS''@!@LIBS@!' \
- -e 's!@''WRAPLIBS''@!@WRAPLIBS@!' \
- -e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
- -e 's!@''openssl_libs''@!@openssl_libs@!' \
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
- -e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
- -e 's!@''HOSTNAME''@!@HOSTNAME@!' \
- -e 's!@''SYSTEM_TYPE''@!@SYSTEM_TYPE@!' \
- -e 's!@''CHECK_PID''@!@CHECK_PID@!' \
- -e 's!@''FIND_PROC''@!@FIND_PROC@!' \
- -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''MYSQL_TCP_PORT_DEFAULT''@!@MYSQL_TCP_PORT_DEFAULT@!' \
- -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \
- -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \
- -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
- -e 's!@''STATIC_NSS_FLAGS''@!@STATIC_NSS_FLAGS@!' \
- -e 's!@''NON_THREADED_LIBS''@!@NON_THREADED_LIBS@!' \
- -e 's!@''ZLIB_DEPS''@!@ZLIB_DEPS@!' \
- -e "s!@MAKE@!$(MAKE)!" \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/scripts/dheadgen.pl b/scripts/dheadgen.pl
new file mode 100755
index 00000000000..c42bd49b32e
--- /dev/null
+++ b/scripts/dheadgen.pl
@@ -0,0 +1,338 @@
+#!/usr/bin/perl -w
+
+#
+# Copyright (c) 2008, 2009 Sun Microsystems, Inc.
+# Use is subject to license terms.
+#
+
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of the above-listed copyright holders nor the names
+# of its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# ident "@(#)dheadgen.pl 1.4 07/06/24 SMI"
+
+#
+# DTrace Header Generator
+# -----------------------
+#
+# This script is meant to mimic the output of dtrace(1M) with the -h
+# (headergen) flag on system that lack native support for DTrace. This script
+# is intended to be integrated into projects that use DTrace's static tracing
+# facilities (USDT), and invoked as part of the build process to have a
+# common build process on all target systems. To facilitate this, this script
+# is licensed under a BSD license. On system with native DTrace support, the
+# dtrace(1M) command will be invoked to create the full header file; on other
+# systems, this script will generated a stub header file.
+#
+# Normally, generated macros take the form PROVIDER_PROBENAME(). It may be
+# desirable to customize the output of this script and of dtrace(1M) to
+# tailor the precise macro name. To do this, edit the emit_dtrace() subroutine
+# to pattern match for the lines you want to customize.
+#
+
+use strict;
+
+my @lines;
+my @tokens = ();
+my $lineno = 0;
+my $newline = 1;
+my $eof = 0;
+my $infile;
+my $outfile;
+my $force = 0;
+
+sub emit_dtrace {
+ my ($line) = @_;
+
+ #
+ # Insert customization here. For example, if you want to change the
+ # name of the macros you may do something like this:
+ #
+ # $line =~ s/(\s)[A-Z]+_/\1TRACE_MOZILLA_/;
+ #
+
+ print $line;
+}
+
+#
+# The remaining code deals with parsing D provider definitions and emitting
+# the stub header file. There should be no need to edit this absent a bug.
+#
+
+#
+# Emit the two relevant macros for each probe in the given provider:
+# PROVIDER_PROBENAME(<args>)
+# PROVIDER_PROBENAME_ENABLED() (0)
+#
+sub emit_provider {
+ my ($provname, @probes) = @_;
+
+ $provname = uc($provname);
+
+ foreach my $probe (@probes) {
+ my $probename = uc($$probe{'name'});
+ my $argc = $$probe{'argc'};
+ my $line;
+
+ $probename =~ s/__/_/g;
+
+ $line = "#define\t${provname}_${probename}(";
+ for (my $i = 0; $i < $argc; $i++) {
+ $line .= ($i == 0 ? '' : ', ');
+ $line .= "arg$i";
+ }
+ $line .= ")\n";
+ emit_dtrace($line);
+
+ $line = "#define\t${provname}_${probename}_ENABLED() (0)\n";
+ emit_dtrace($line);
+ }
+
+ emit_dtrace("\n");
+}
+
+sub emit_prologue {
+ my ($filename) = @_;
+
+ $filename =~ s/.*\///g;
+ $filename = uc($filename);
+ $filename =~ s/\./_/g;
+
+ emit_dtrace <<"EOF";
+/*
+ * Generated by dheadgen(1).
+ */
+
+#ifndef\t_${filename}
+#define\t_${filename}
+
+#ifdef\t__cplusplus
+extern "C" {
+#endif
+
+EOF
+}
+
+sub emit_epilogue {
+ my ($filename) = @_;
+
+ $filename =~ s/.*\///g;
+ $filename = uc($filename);
+ $filename =~ s/\./_/g;
+
+ emit_dtrace <<"EOF";
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _$filename */
+EOF
+}
+
+#
+# Get the next token from the file keeping track of the line number.
+#
+sub get_token {
+ my ($eof_ok) = @_;
+ my $tok;
+
+ while (1) {
+ while (scalar(@tokens) == 0) {
+ if (scalar(@lines) == 0) {
+ $eof = 1;
+ return if ($eof_ok);
+ die "expected more data at line $lineno";
+ }
+
+ $lineno++;
+ push(@tokens, split(/(\s+|\n|[(){},#;]|\/\*|\*\/)/,
+ shift(@lines)));
+ }
+
+ $tok = shift(@tokens);
+ next if ($tok eq '');
+ next if ($tok =~ /^[ \t]+$/);
+
+ return ($tok);
+ }
+}
+
+#
+# Ignore newlines, comments and typedefs
+#
+sub next_token {
+ my ($eof_ok) = @_;
+ my $tok;
+
+ while (1) {
+ $tok = get_token($eof_ok);
+ return if ($eof_ok && $eof);
+ if ($tok eq "typedef" or $tok =~ /^#/) {
+ while (1) {
+ $tok = get_token(0);
+ last if ($tok eq "\n");
+ }
+ next;
+ } elsif ($tok eq '/*') {
+ while (get_token(0) ne '*/') {
+ next;
+ }
+ next;
+ } elsif ($tok eq "\n") {
+ next;
+ }
+
+ last;
+ }
+
+ return ($tok);
+}
+
+sub expect_token {
+ my ($t) = @_;
+ my $tok;
+
+ while (($tok = next_token(0)) eq "\n") {
+ next;
+ }
+
+ die "expected '$t' at line $lineno rather than '$tok'" if ($t ne $tok);
+}
+
+sub get_args {
+ expect_token('(');
+
+ my $tok = next_token(0);
+ my @args = ();
+
+ return (@args) if ($tok eq ')');
+
+ if ($tok eq 'void') {
+ expect_token(')');
+ return (@args);
+ }
+
+ my $arg = $tok;
+
+ while (1) {
+ $tok = next_token(0);
+ if ($tok eq ',' || $tok eq ')') {
+ push(@args, $arg);
+ $arg = '';
+ last if ($tok eq ')');
+ } else {
+ $arg = "$arg $tok";
+ }
+ }
+
+ return (@args);
+}
+
+sub usage {
+ die "usage: $0 [-f] <filename.d>\n";
+}
+
+usage() if (scalar(@ARGV) < 1);
+if ($ARGV[0] eq '-f') {
+ usage() if (scalar(@ARGV < 2));
+ $force = 1;
+ shift;
+}
+$infile = $ARGV[0];
+usage() if ($infile !~ /(.+)\.d$/);
+
+#
+# If the system has native support for DTrace, we'll use that binary instead.
+#
+if (-x '/usr/sbin/dtrace' && !$force) {
+ open(DTRACE, "-| /usr/sbin/dtrace -C -h -s $infile -o /dev/stdout")
+ or die "can't invoke dtrace(1M)";
+
+ while (<DTRACE>) {
+ emit_dtrace($_);
+ }
+
+ close(DTRACE);
+
+ exit(0);
+}
+
+emit_prologue($infile);
+
+open(D, "< $infile") or die "couldn't open $infile";
+@lines = <D>;
+close(D);
+
+while (1) {
+ my $nl = 0;
+ my $tok = next_token(1);
+ last if $eof;
+
+ if ($newline && $tok eq '#') {
+ while (1) {
+ $tok = get_token(0);
+
+ last if ($tok eq "\n");
+ }
+ $nl = 1;
+ } elsif ($tok eq "\n") {
+ $nl = 1;
+ } elsif ($tok eq 'provider') {
+ my $provname = next_token(0);
+ my @probes = ();
+ expect_token('{');
+
+ while (1) {
+ $tok = next_token(0);
+ if ($tok eq 'probe') {
+ my $probename = next_token(0);
+ my @args = get_args();
+
+ next while (next_token(0) ne ';');
+
+ push(@probes, {
+ 'name' => $probename,
+ 'argc' => scalar(@args)
+ });
+
+ } elsif ($tok eq '}') {
+ expect_token(';');
+
+ emit_provider($provname, @probes);
+
+ last;
+ }
+ }
+
+ } else {
+ die "syntax error at line $lineno near '$tok'\n";
+ }
+
+ $newline = $nl;
+}
+
+emit_epilogue($infile);
+
+exit(0);
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 2ccd4f51b69..5ccdb2b914c 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -64,6 +64,7 @@ cflags="@CFLAGS@"
STRIP=1 # Option ignored
SILENT=0
+MALLOC_LIB=
PLATFORM=""
TMP=/tmp
NEW_NAME="" # Final top directory and TAR package name
@@ -76,6 +77,7 @@ for arg do
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--short-product-tag=*) SHORT_PRODUCT_TAG=`echo "$arg" | sed -e "s;--short-product-tag=;;"` ;;
+ --inject-malloc-lib=*) MALLOC_LIB=`echo "$arg" | sed -e 's;^[^=]*=;;'` ;;
--no-strip) STRIP=0 ;;
--machine=*) machine=`echo "$arg" | sed -e "s;--machine=;;"` ;;
--platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;;
@@ -160,10 +162,6 @@ fi
# Print the platform name for build logs
echo "PLATFORM NAME: $PLATFORM"
-case $PLATFORM in
- *netware*) BASE_SYSTEM="netware" ;;
-esac
-
# Change the distribution to a long descriptive name
# For the cluster product, concentrate on the second part
VERSION_NAME=@VERSION@
@@ -224,313 +222,121 @@ fi
#
##############################################################################
-if [ x"$BASE_SYSTEM" != x"netware" ] ; then
-
- # ----------------------------------------------------------------------
- # Terminate on any base level error
- # ----------------------------------------------------------------------
- set -e
-
- # ----------------------------------------------------------------------
- # Really ugly, one script, "mysql_install_db", needs prefix set to ".",
- # i.e. makes access relative the current directory. This matches
- # the documentation, so better not change this. And for another script,
- # "mysql.server", we make some relative, others not.
- # ----------------------------------------------------------------------
-
- cd scripts
- rm -f mysql_install_db
- @MAKE@ mysql_install_db \
- prefix=. \
- bindir=./bin \
- sbindir=./bin \
- scriptdir=./bin \
- libexecdir=./bin \
- pkgdatadir=./share \
- localstatedir=./data
- cd ..
-
- cd support-files
- rm -f mysql.server
- @MAKE@ mysql.server \
- bindir=./bin \
- sbindir=./bin \
- scriptdir=./bin \
- libexecdir=./bin \
- pkgdatadir=@pkgdatadir@
- cd ..
-
- # ----------------------------------------------------------------------
- # Do a install that we later are to pack. Use the same paths as in
- # the build for the relevant directories.
- # ----------------------------------------------------------------------
- @MAKE@ DESTDIR=$BASE install \
- pkglibdir=@pkglibdir@ \
- pkgincludedir=@pkgincludedir@ \
- pkgdatadir=@pkgdatadir@ \
- pkgplugindir=@pkgplugindir@ \
- pkgsuppdir=@pkgsuppdir@ \
- mandir=@mandir@ \
- infodir=@infodir@
-
- # ----------------------------------------------------------------------
- # Rename top directory, and set DEST to the new directory
- # ----------------------------------------------------------------------
- mv $BASE@prefix@ $BASE/$NEW_NAME
- DEST=$BASE/$NEW_NAME
-
- # ----------------------------------------------------------------------
- # If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a
- # ----------------------------------------------------------------------
- if [ x"@GXX@" = x"yes" ] ; then
- gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
- if [ -z "$gcclib" ] ; then
- echo "Warning: Compiler doesn't tell libgcc.a!"
- elif [ -f "$gcclib" ] ; then
- $CP $gcclib $DEST/lib/libmygcc.a
- else
- echo "Warning: Compiler result '$gcclib' not found / no file!"
- fi
- fi
-
- # FIXME let this script be in "bin/", where it is in the RPMs?
- # http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html
- mkdir $DEST/scripts
- mv $DEST/bin/mysql_install_db $DEST/scripts/
-
- # Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1
+# ----------------------------------------------------------------------
+# Terminate on any base level error
+# ----------------------------------------------------------------------
+set -e
- # Copy readme and license files
- cp README Docs/INSTALL-BINARY $DEST/
- if [ -f COPYING ] ; then
- cp COPYING $DEST/
- elif [ -f LICENSE.mysql ] ; then
- cp LICENSE.mysql $DEST/
- else
- echo "ERROR: no license files found"
- exit 1
- fi
+# ----------------------------------------------------------------------
+# Really ugly, one script, "mysql_install_db", needs prefix set to ".",
+# i.e. makes access relative the current directory. This matches
+# the documentation, so better not change this. And for another script,
+# "mysql.server", we make some relative, others not.
+# ----------------------------------------------------------------------
- # FIXME should be handled by make file, and to other dir
- mkdir -p $DEST/bin $DEST/support-files
- cp scripts/mysqlaccess.conf $DEST/bin/
- cp support-files/magic $DEST/support-files/
+cd scripts
+rm -f mysql_install_db
+@MAKE@ mysql_install_db \
+ prefix=. \
+ bindir=./bin \
+ sbindir=./bin \
+ scriptdir=./bin \
+ libexecdir=./bin \
+ pkgdatadir=./share \
+ localstatedir=./data
+cd ..
+
+cd support-files
+rm -f mysql.server
+@MAKE@ mysql.server \
+ bindir=./bin \
+ sbindir=./bin \
+ scriptdir=./bin \
+ libexecdir=./bin \
+ pkgdatadir=@pkgdatadir@
+cd ..
- # Create empty data directories, set permission (FIXME why?)
- mkdir $DEST/data $DEST/data/mysql $DEST/data/test
- chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test
+# ----------------------------------------------------------------------
+# Do a install that we later are to pack. Use the same paths as in
+# the build for the relevant directories.
+# ----------------------------------------------------------------------
+@MAKE@ DESTDIR=$BASE install \
+ pkglibdir=@pkglibdir@ \
+ pkgincludedir=@pkgincludedir@ \
+ pkgdatadir=@pkgdatadir@ \
+ pkgplugindir=@pkgplugindir@ \
+ pkgsuppdir=@pkgsuppdir@ \
+ mandir=@mandir@ \
+ infodir=@infodir@
- # ----------------------------------------------------------------------
- # Create the result tar file
- # ----------------------------------------------------------------------
+# ----------------------------------------------------------------------
+# Rename top directory, and set DEST to the new directory
+# ----------------------------------------------------------------------
+mv $BASE@prefix@ $BASE/$NEW_NAME
+DEST=$BASE/$NEW_NAME
- echo "Using $tar to create archive"
- OPT=cvf
- if [ x$SILENT = x1 ] ; then
- OPT=cf
+# ----------------------------------------------------------------------
+# If we compiled with gcc, copy libgcc.a to the dist as libmygcc.a
+# ----------------------------------------------------------------------
+if [ x"@GXX@" = x"yes" ] ; then
+ gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
+ if [ -z "$gcclib" ] ; then
+ echo "Warning: Compiler doesn't tell libgcc.a!"
+ elif [ -f "$gcclib" ] ; then
+ $CP $gcclib $DEST/lib/libmygcc.a
+ else
+ echo "Warning: Compiler result '$gcclib' not found / no file!"
fi
-
- echo "Creating and compressing archive"
- rm -f $NEW_NAME.tar.gz
- (cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
- echo "$NEW_NAME.tar.gz created"
-
- echo "Removing temporary directory"
- rm -rf $BASE
- exit 0
fi
+# If requested, add a malloc library .so into pkglibdir for use
+# by mysqld_safe
+if [ -n "$MALLOC_LIB" ]; then
+ cp "$MALLOC_LIB" "$DEST/lib/"
+fi
-##############################################################################
-#
-# Handle the Netware case, until integrated above
-#
-##############################################################################
+# FIXME let this script be in "bin/", where it is in the RPMs?
+# http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html
+mkdir $DEST/scripts
+mv $DEST/bin/mysql_install_db $DEST/scripts/
-BS=".nlm"
-MYSQL_SHARE=$BASE/share
-
-mkdir $BASE $BASE/bin $BASE/docs \
- $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
- $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
- $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \
- $BASE/mysql-test/suite
-
-# Copy files if they exists, warn for those that don't.
-# Note that when listing files to copy, we might list the file name
-# twice, once in the directory location where it is built, and a
-# second time in the ".libs" location. In the case the first one
-# is a wrapper script, the second one will overwrite it with the
-# binary file.
-copyfileto()
-{
- destdir=$1
- shift
- for i
- do
- if [ -f $i ] ; then
- $CP $i $destdir
- elif [ -d $i ] ; then
- echo "Warning: Will not copy directory \"$i\""
- else
- echo "Warning: Listed file not found \"$i\""
- fi
- done
-}
+# Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1
-copyfileto $BASE/docs ChangeLog Docs/mysql.info
-
-copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \
- LICENSE.mysql
-
-# Non platform-specific bin dir files:
-BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
- extra/resolveip$BS extra/my_print_defaults$BS \
- extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \
- storage/myisam/myisamchk$BS storage/myisam/myisampack$BS \
- storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \
- sql/mysqld$BS sql/mysqld-debug$BS \
- sql/mysql_tzinfo_to_sql$BS \
- server-tools/instance-manager/mysqlmanager$BS \
- client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
- client/mysqlslap$BS \
- client/mysqldump$BS client/mysqlimport$BS \
- client/mysqltest$BS client/mysqlcheck$BS \
- client/mysqlbinlog$BS client/mysql_upgrade$BS \
- tests/mysql_client_test$BS \
- libmysqld/examples/mysql_client_test_embedded$BS \
- libmysqld/examples/mysqltest_embedded$BS \
- ";
-
-# Platform-specific bin dir files:
-BIN_FILES="$BIN_FILES \
- netware/mysqld_safe$BS netware/mysql_install_db$BS \
- netware/init_db.sql netware/test_db.sql \
- netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql \
- ";
-
-copyfileto $BASE/bin $BIN_FILES
-
-$CP netware/*.pl $BASE/scripts
-$CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
-
-copyfileto $BASE/lib \
- libmysql/.libs/libmysqlclient.a \
- libmysql/.libs/libmysqlclient.so* \
- libmysql/.libs/libmysqlclient.sl* \
- libmysql/.libs/libmysqlclient*.dylib \
- libmysql/libmysqlclient.* \
- libmysql_r/.libs/libmysqlclient_r.a \
- libmysql_r/.libs/libmysqlclient_r.so* \
- libmysql_r/.libs/libmysqlclient_r.sl* \
- libmysql_r/.libs/libmysqlclient_r*.dylib \
- libmysql_r/libmysqlclient_r.* \
- libmysqld/.libs/libmysqld.a \
- libmysqld/.libs/libmysqld.so* \
- libmysqld/.libs/libmysqld.sl* \
- libmysqld/.libs/libmysqld*.dylib \
- mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \
- libmysqld/libmysqld.a netware/libmysql.imp \
- zlib/.libs/libz.a
-
-# convert the .a to .lib for NetWare
-for i in $BASE/lib/*.a
-do
- libname=`basename $i .a`
- $MV $i $BASE/lib/$libname.lib
-done
-rm -f $BASE/lib/*.la
-
-
-copyfileto $BASE/include config.h include/*
-
-rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
-
-# In a NetWare binary package, these tools and their manuals are not useful
-rm -f $BASE/man/man1/make_win_*
-
-copyfileto $BASE/support-files support-files/*
-
-copyfileto $BASE/share scripts/*.sql
-
-$CP -r sql/share/* $MYSQL_SHARE
-rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
-
-copyfileto $BASE/mysql-test \
- mysql-test/mysql-test-run mysql-test/install_test_db \
- mysql-test/mysql-test-run.pl mysql-test/README \
- mysql-test/mysql-stress-test.pl \
- mysql-test/valgrind.supp \
- netware/mysql_test_run.nlm netware/install_test_db.ncf
-
-$CP mysql-test/lib/*.pl $BASE/mysql-test/lib
-$CP mysql-test/t/*.def $BASE/mysql-test/t
-$CP mysql-test/include/*.inc $BASE/mysql-test/include
-$CP mysql-test/include/*.sql $BASE/mysql-test/include
-$CP mysql-test/include/*.test $BASE/mysql-test/include
-$CP mysql-test/t/*.def $BASE/mysql-test/t
-$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
- mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \
- mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \
- mysql-test/std_data/Index.xml \
- mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
- mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \
- $BASE/mysql-test/std_data
-# Attention: when the wildcards expand to a line that is very long,
-# it may exceed the command line length limit on some platform(s). Bug#54590
-$CP mysql-test/t/*.test mysql-test/t/*.imtest $BASE/mysql-test/t
-$CP mysql-test/t/*.disabled mysql-test/t/*.opt $BASE/mysql-test/t
-$CP mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
-$CP mysql-test/r/*.result mysql-test/r/*.require \
- $BASE/mysql-test/r
-
-# Copy the additional suites "as is", they are in flux
-$tar cf - mysql-test/suite | ( cd $BASE ; $tar xf - )
-# Clean up if we did this from a bk tree
-if [ -d mysql-test/SCCS ] ; then
- find $BASE/mysql-test -name SCCS -print | xargs rm -rf
+# Copy readme and license files
+cp README Docs/INSTALL-BINARY $DEST/
+if [ -f COPYING ] ; then
+ cp COPYING $DEST/
+elif [ -f LICENSE.mysql ] ; then
+ cp LICENSE.mysql $DEST/
+else
+ echo "ERROR: no license files found"
+ exit 1
fi
-rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
- $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
- $BASE/bin/make_win_* \
- $BASE/bin/setsomevars $BASE/support-files/Makefile* \
- $BASE/support-files/*.sh
+# FIXME should be handled by make file, and to other dir
+mkdir -p $DEST/bin $DEST/support-files
+cp scripts/mysqlaccess.conf $DEST/bin/
+cp support-files/magic $DEST/support-files/
-#
-# Copy system dependent files
-#
-./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
+# Create empty data directories, set permission (FIXME why?)
+mkdir $DEST/data $DEST/data/mysql $DEST/data/test
+chmod o-rwx $DEST/data $DEST/data/mysql $DEST/data/test
-#
-# Remove system dependent files
-#
-rm -f $BASE/support-files/magic \
- $BASE/support-files/mysql.server \
- $BASE/support-files/mysql*.spec \
- $BASE/support-files/mysql-log-rotate \
- $BASE/support-files/binary-configure \
- $BASE/support-files/build-tags \
- $BASE/support-files/MySQL-shared-compat.spec \
- $BASE/INSTALL-BINARY
-
-# Clean up if we did this from a bk tree
-if [ -d $BASE/sql-bench/SCCS ] ; then
- find $BASE/share -name SCCS -print | xargs rm -rf
- find $BASE/sql-bench -name SCCS -print | xargs rm -rf
-fi
+# ----------------------------------------------------------------------
+# Create the result tar file
+# ----------------------------------------------------------------------
-BASE2=$TMP/$NEW_NAME
-rm -rf $BASE2
-mv $BASE $BASE2
-BASE=$BASE2
+echo "Using $tar to create archive"
+OPT=cvf
+if [ x$SILENT = x1 ] ; then
+ OPT=cf
+fi
-#
-# Create a zip file for NetWare users
-#
-rm -f $NEW_NAME.zip
-(cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME)
-echo "$NEW_NAME.zip created"
+echo "Creating and compressing archive"
+rm -f $NEW_NAME.tar.gz
+(cd $BASE ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
+echo "$NEW_NAME.tar.gz created"
echo "Removing temporary directory"
rm -rf $BASE
+exit 0
diff --git a/scripts/make_sharedlib_distribution.sh b/scripts/make_sharedlib_distribution.sh
deleted file mode 100644
index f6669788233..00000000000
--- a/scripts/make_sharedlib_distribution.sh
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2003-2004, 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# The default path should be /usr/local
-
-# Get some info from configure
-# chmod +x ./scripts/setsomevars
-
-machine=@MACHINE_TYPE@
-system=@SYSTEM_TYPE@
-version=@VERSION@
-export machine system version
-SOURCE=`pwd`
-CP="cp -p"
-MV="mv"
-
-STRIP=1
-DEBUG=0
-SILENT=0
-TMP=/tmp
-SUFFIX=""
-
-parse_arguments() {
- for arg do
- case "$arg" in
- --debug) DEBUG=1;;
- --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
- --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
- --no-strip) STRIP=0 ;;
- --silent) SILENT=1 ;;
- *)
- echo "Unknown argument '$arg'"
- exit 1
- ;;
- esac
- done
-}
-
-parse_arguments "$@"
-
-BASE=$TMP/my_dist$SUFFIX
-
-if [ -d $BASE ] ; then
- rm -r -f $BASE
-fi
-
-mkdir -p $BASE/lib
-
-for i in \
- libmysql/.libs/libmysqlclient.so* \
- libmysql/.libs/libmysqlclient.sl* \
- libmysql/.libs/libmysqlclient*.dylib \
- libmysql_r/.libs/libmysqlclient_r.so* \
- libmysql_r/.libs/libmysqlclient_r.sl* \
- libmysql_r/.libs/libmysqlclient_r*.dylib
-do
- if [ -f $i ]
- then
- $CP $i $BASE/lib
- fi
-done
-
-# Change the distribution to a long descriptive name
-NEW_NAME=mysql-shared-$version-$system-$machine$SUFFIX
-BASE2=$TMP/$NEW_NAME
-rm -r -f $BASE2
-mv $BASE $BASE2
-BASE=$BASE2
-
-#if we are debugging, do not do tar/gz
-if [ x$DEBUG = x1 ] ; then
- exit
-fi
-
-# This is needed to prefer GNU tar instead of tar because tar can't
-# always handle long filenames
-
-PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
-which_1 ()
-{
- for cmd
- do
- for d in $PATH_DIRS
- do
- for file in $d/$cmd
- do
- if test -x $file -a ! -d $file
- then
- echo $file
- exit 0
- fi
- done
- done
- done
- exit 1
-}
-
-#
-# Create the result tar file
-#
-
-tar=`which_1 gnutar gtar`
-if test "$?" = "1" -o "$tar" = ""
-then
- tar=tar
-fi
-
-echo "Using $tar to create archive"
-cd $TMP
-
-OPT=cvf
-if [ x$SILENT = x1 ] ; then
- OPT=cf
-fi
-
-$tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
-cd $SOURCE
-echo "Compressing archive"
-gzip -9 $NEW_NAME.tar
-echo "Removing temporary directory"
-rm -r -f $BASE
-
-echo "$NEW_NAME.tar.gz created"
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index 9f4a6f9716b..00ef9186d48 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -146,9 +146,7 @@ mkdir $DESTDIR/bin
cp client/$TARGET/*.exe $DESTDIR/bin/
cp extra/$TARGET/*.exe $DESTDIR/bin/
cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/
-cp server-tools/instance-manager/$TARGET/*.{exe,map} $DESTDIR/bin/
if [ x"$TARGET" != x"release" ] ; then
- cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/
cp client/$TARGET/mysql.pdb $DESTDIR/bin/
cp client/$TARGET/mysqladmin.pdb $DESTDIR/bin/
cp client/$TARGET/mysqlbinlog.pdb $DESTDIR/bin/
@@ -160,7 +158,6 @@ cp tests/$TARGET/*.exe $DESTDIR/bin/
cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/
cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe
-cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map
if [ x"$TARGET" != x"release" ] ; then
cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb
fi
@@ -169,7 +166,6 @@ if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/mysqld.exe" -o \
x"$PACK_DEBUG" = x"yes" ] ; then
cp sql/debug/mysqld.exe $DESTDIR/bin/mysqld-debug.exe
cp sql/debug/mysqld.pdb $DESTDIR/bin/mysqld-debug.pdb
- cp sql/debug/mysqld.map $DESTDIR/bin/mysqld-debug.map
fi
# ----------------------------------------------------------------------
@@ -254,6 +250,7 @@ cp include/mysql.h \
include/decimal.h \
include/errmsg.h \
include/my_global.h \
+ include/my_config.h \
include/my_net.h \
include/my_getopt.h \
include/sslopt-longopts.h \
@@ -269,7 +266,6 @@ cp include/mysql.h \
include/sql_state.h \
include/mysqld_ername.h \
include/mysql_version.h \
- include/config-win.h \
libmysql/libmysql.def \
$DESTDIR/include/
@@ -294,6 +290,11 @@ if [ -d storage/innodb_plugin ]; then
cp storage/innodb_plugin/$TARGET/ha_innodb_plugin.dll \
$DESTDIR/lib/plugin/
fi
+if [ -d plugin/semisync ]; then
+ cp plugin/semisync/$TARGET/semisync_master.dll \
+ plugin/semisync/$TARGET/semisync_slave.dll \
+ $DESTDIR/lib/plugin/
+fi
if [ x"$TARGET" != x"release" ] ; then
cp libmysql/$TARGET/libmysql.pdb \
@@ -306,6 +307,11 @@ if [ x"$TARGET" != x"release" ] ; then
cp storage/innodb_plugin/$TARGET/ha_innodb_plugin.pdb \
$DESTDIR/lib/plugin/
fi
+ if [ -d plugin/semisync ]; then
+ cp plugin/semisync/$TARGET/semisync_master.pdb \
+ plugin/semisync/$TARGET/semisync_slave.pdb \
+ $DESTDIR/lib/plugin/
+ fi
fi
@@ -332,6 +338,15 @@ if [ x"$PACK_DEBUG" = x"" -a -f "libmysql/debug/libmysql.lib" -o \
storage/innodb_plugin/debug/ha_innodb_plugin.pdb \
$DESTDIR/lib/plugin/debug/
fi
+ if [ -d plugin/semisync ]; then
+ cp plugin/semisync/debug/semisync_master.dll \
+ plugin/semisync/debug/semisync_master.lib \
+ plugin/semisync/debug/semisync_master.pdb \
+ plugin/semisync/debug/semisync_slave.dll \
+ plugin/semisync/debug/semisync_slave.lib \
+ plugin/semisync/debug/semisync_slave.pdb \
+ $DESTDIR/lib/plugin/debug/
+ fi
fi
# ----------------------------------------------------------------------
@@ -382,15 +397,15 @@ cp scripts/*.sql $DESTDIR/share/
# Clean up from possibly copied SCCS directories
# ----------------------------------------------------------------------
-rm -rf `find $DISTDIR -type d -name SCCS -print`
+rm -rf `find $DESTDIR -type d -name SCCS -print`
# ----------------------------------------------------------------------
# Copy other files specified on command line DEST=SOURCE
# ----------------------------------------------------------------------
for arg do
- dst=`echo $arg | sed 's/=.*$//'`
- src=`echo $arg | sed 's/^.*=//'`
+ dst=`echo $arg | sed -n 's/=.*$//p'`
+ src=`echo $arg | sed -n 's/^.*=//p'`
if [ x"$dst" = x"" -o x"$src" = x"" ] ; then
echo "Invalid specification of what to copy"
diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in
index 570be1b770f..78200278833 100644
--- a/scripts/mysql_config.pl.in
+++ b/scripts/mysql_config.pl.in
@@ -1,8 +1,7 @@
#!/usr/bin/perl
# -*- cperl -*-
#
-# Copyright (c) 2007 MySQL AB, 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -43,8 +42,7 @@ use Cwd;
use strict;
my @exclude_cflags =
- qw/DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX
- DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
+ qw/DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
DEXTRA_DEBUG DHAVE_purify O O[0-9] xO[0-9] W[-A-Za-z]*
Xa xstrconst xc99=none
unroll2 ip mp restrict/;
@@ -203,7 +201,7 @@ $flags->{libs} =
$flags->{libs_r} =
[@ldflags,@lib_r_opts,'@ZLIB_DEPS@','@LIBS@','@openssl_libs@'];
$flags->{embedded_libs} =
- [@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@innodb_system_libs@','@openssl_libs@'];
+ [@ldflags,@lib_e_opts,'@LIBDL@','@ZLIB_DEPS@','@LIBS@','@WRAPLIBS@','@openssl_libs@'];
$flags->{include} = ["-I$pkgincludedir"];
$flags->{cflags} = [@{$flags->{include}},split(" ",'@CFLAGS@')];
diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh
index 7dc9beb3b90..92960756777 100644
--- a/scripts/mysql_config.sh
+++ b/scripts/mysql_config.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-# Copyright (c) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,9 +88,15 @@ pkglibdir_rel=`echo $pkglibdir | sed -e "s;^$basedir/;;"`
fix_path pkglibdir $pkglibdir_rel lib/mysql lib
plugindir='@pkgplugindir@'
+plugindir_rel=`echo $plugindir | sed -e "s;^$basedir/;;"`
+fix_path plugindir $plugindir_rel lib/mysql/plugin lib/plugin
pkgincludedir='@pkgincludedir@'
-fix_path pkgincludedir include/mysql include
+if [ -f "$basedir/include/mysql/mysql.h" ]; then
+ pkgincludedir="$basedir/include/mysql"
+elif [ -f "$basedir/include/mysql.h" ]; then
+ pkgincludedir="$basedir/include"
+fi
version='@VERSION@'
socket='@MYSQL_UNIX_ADDR@'
@@ -107,8 +112,8 @@ fi
# We intentionally add a space to the beginning and end of lib strings, simplifies replace later
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
-libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
-embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ "
+libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @CLIENT_LIBS@ @openssl_libs@ "
+embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @openssl_libs@ "
if [ -r "$pkglibdir/libmygcc.a" ]; then
# When linking against the static library with a different version of GCC
@@ -128,8 +133,7 @@ include="-I$pkgincludedir"
# and -xstrconst to make --cflags usable for Sun Forte C++
# FIXME until we have a --cxxflags, we need to remove -AC99
# to make --cflags usable for HP C++ (aCC)
-for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
- DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
+for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
Xa xstrconst "xc99=none" AC99 \
@@ -168,6 +172,10 @@ Options:
--port [$port]
--version [$version]
--libmysqld-libs [$embedded_libs]
+ --variable=VAR VAR is one of:
+ pkgincludedir [$pkgincludedir]
+ pkglibdir [$pkglibdir]
+ plugindir [$plugindir]
EOF
exit 1
}
@@ -185,6 +193,15 @@ while test $# -gt 0; do
--port) echo "$port" ;;
--version) echo "$version" ;;
--embedded-libs | --embedded | --libmysqld-libs) echo "$embedded_libs" ;;
+ --variable=*)
+ var=`echo "$1" | sed 's,^[^=]*=,,'`
+ case "$var" in
+ pkgincludedir) echo "$pkgincludedir" ;;
+ pkglibdir) echo "$pkglibdir" ;;
+ plugindir) echo "$plugindir" ;;
+ *) usage ;;
+ esac
+ ;;
*) usage ;;
esac
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
deleted file mode 100644
index 3b179957932..00000000000
--- a/scripts/mysql_fix_privilege_tables.sh
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2000-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This script is a wrapper to pipe the mysql_fix_privilege_tables.sql
-# through the mysql client program to the mysqld server
-
-# Default values (Can be changed in my.cnf)
-password=""
-host="localhost"
-user="root"
-sql_only=0
-basedir="@prefix@"
-verbose=0
-args=""
-# no elaborate fallback here; with no argument, it will happen in "mysql"
-port=""
-socket=""
-database="mysql"
-bindir=""
-pkgdatadir="@pkgdatadir@"
-print_defaults_bindir="."
-
-file=mysql_fix_privilege_tables.sql
-
-# The following test is to make this script compatible with the 4.0 where
-# the single argument could be a password
-if test "$#" = 1
-then
- case "$1" in
- --*) ;;
- *) old_style_password="$1" ; shift ;;
- esac
-fi
-
-# The following code is almost identical to the code in mysql_install_db.sh
-
-case "$1" in
- --no-defaults|--defaults-file=*|--defaults-extra-file=*)
- defaults="$1"; shift
- ;;
-esac
-
-parse_arguments() {
- # We only need to pass arguments through to the server if we don't
- # handle them here. So, we collect unrecognized options (passed on
- # the command line) into the args variable.
- pick_args=
- if test "$1" = PICK-ARGS-FROM-ARGV
- then
- pick_args=1
- shift
- fi
-
- for arg do
- case "$arg" in
- --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --sql|--sql-only) sql_only=1 ;;
- --verbose) verbose=1 ;;
- --port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
- --socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
- --database=*) database=`echo "$arg" | sed -e "s;--database=;;"` ;;
- --bindir=*) bindir=`echo "$arg" | sed -e "s;--bindir=;;"`
- print_defaults_bindir=$bindir
- ;;
- *)
- if test -n "$pick_args"
- then
- # This sed command makes sure that any special chars are quoted,
- # so the arg gets passed exactly to the server.
- args="$args "`echo "$arg" | sed -e 's,\([^=a-zA-Z0-9_.-]\),\\\\\1,g'`
- fi
- ;;
- esac
- done
-}
-
-# Get first arguments from the my.cfg file, groups [mysqld] and
-# [mysql_install_db], and then merge with the command line arguments
-
-print_defaults=my_print_defaults
-for dir in ./bin @bindir@ @bindir@ extra $print_defaults_bindir/../bin $print_defaults_bindir/../extra
-do
- if test -x $dir/my_print_defaults
- then
- print_defaults="$dir/my_print_defaults"
- break
- fi
-done
-
-parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables`
-parse_arguments PICK-ARGS-FROM-ARGV "$@"
-
-if test -z "$password"
-then
- password=$old_style_password
-fi
-
-# Find where 'mysql' command is located
-
-dirname=`dirname "$0"`
-
-if test -z "$bindir"
-then
- for i in @bindir@ $basedir/bin "$dirname/../client"
- do
- if test -f $i/mysql
- then
- bindir=$i
- break
- fi
- done
-fi
-
-if test -z "$bindir"
-then
- echo "Could not find MySQL command-line client (mysql)."
- echo "Please use --basedir to specify the directory where MySQL is installed."
- exit 1
-fi
-
-cmd="$bindir/mysql --no-defaults --force --user=$user --host=$host"
-if test ! -z "$port"; then
- cmd="$cmd --port=$port"
-fi
-if test ! -z "$socket"; then
- cmd="$cmd --socket=$socket"
-fi
-cmd="$cmd --database=$database"
-
-if test $sql_only = 1
-then
- cmd="cat"
-fi
-
-# Find where first mysql_fix_privilege_tables.sql is located
-for i in $basedir/support-files $basedir/share $basedir/share/mysql \
- $basedir/scripts $pkgdatadir . "$dirname"
-do
- if test -f $i/$file
- then
- pkgdatadir=$i
- break
- fi
-done
-
-sql_file="$pkgdatadir/$file"
-if test ! -f $sql_file
-then
- echo "Could not find file '$file'."
- echo "Please use --basedir to specify the directory where MySQL is installed"
- exit 1
-fi
-
-s_echo()
-{
- if test $sql_only = 0
- then
- echo $1
- fi
-}
-
-s_echo "This script updates all the mysql privilege tables to be usable by"
-s_echo "the current version of MySQL"
-s_echo ""
-
-if test $verbose = 1
-then
- s_echo "You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
- s_echo "because these just mean that your tables are already up to date."
- s_echo "This script is safe to run even if your tables are already up to date!"
- s_echo ""
-fi
-
-run_cmd() {
- # Password argument is added here to allow for spaces in password.
-
- if test ! -z "$password"
- then
- cat $sql_file | $cmd --password="$password"
- else
- cat $sql_file | $cmd
- fi
-}
-
-if test $verbose = 0
-then
- run_cmd > /dev/null 2>&1
-else
- run_cmd > /dev/null
-fi
-if test $? = 0
-then
- s_echo "done"
-else
- s_echo "Got a failure from command:"
- s_echo "cat $sql_file | $cmd"
- s_echo "Please check the above output and try again."
- if test $verbose = 0
- then
- s_echo ""
- s_echo "Running the script with the --verbose option may give you some information"
- s_echo "of what went wrong."
- fi
- s_echo ""
- s_echo "If you get an 'Access denied' error, you should run this script again and"
- s_echo "give the MySQL root user password as an argument with the --password= option"
-fi
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 9782a37c462..88b0823482f 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -319,7 +319,7 @@ then
cannot_find_file "$langdir/errmsg.sys"
exit 1
fi
- mysqld_opt="--language=$langdir"
+ mysqld_opt="--lc-messages-dir=$langdir/.."
fi
# Try to determine the hostname
@@ -364,9 +364,15 @@ do
mkdir -p $dir
chmod 700 $dir
fi
- if test -w / -a ! -z "$user"
+ if test -n "$user"
then
chown $user $dir
+ if test $? -ne 0
+ then
+ echo "Cannot change ownership of the database directories to the '$user'"
+ echo "user. Check that you have the necessary permissions and try again."
+ exit 1
+ fi
fi
done
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 80cba6e5736..9c34b0f5967 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -1,15 +1,14 @@
--- Copyright (c) 2007, 2008 MySQL AB, 2009 Sun Microsystems, Inc.
--- Use is subject to license terms.
---
+-- Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
---
+--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
---
+--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -29,7 +28,7 @@ set @had_db_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, plugin char(64) DEFAULT '', authentication_string TEXT, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
-- Remember for later if user table already existed
set @had_user_table= @@warning_count != 0;
@@ -38,15 +37,15 @@ set @had_user_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl char(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='MySQL plugins';
+CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
-CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
+CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
+CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
@@ -76,9 +75,9 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign
CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
+CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
-CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
+CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-- Create general_log if CSV is enabled.
@@ -101,3 +100,385 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
+--
+-- PERFORMANCE SCHEMA INSTALLATION
+-- Note that this script is also reused by mysql_upgrade,
+-- so we have to be very careful here to not destroy any
+-- existing database named 'performance_schema' if it
+-- can contain user data.
+-- In case of downgrade, it's ok to drop unknown tables
+-- from a future version, as long as they belong to the
+-- performance schema engine.
+--
+
+set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');
+
+SET @l1="SET @broken_tables = (select count(*) from information_schema.tables";
+SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')";
+SET @cmd=concat(@l1,@l2);
+
+-- Work around for bug#49542
+SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @l1="SET @broken_views = (select count(*) from information_schema.views";
+SET @l2=" where table_schema='performance_schema')";
+SET @cmd=concat(@l1,@l2);
+
+-- Work around for bug#49542
+SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
+
+SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
+
+SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
+
+--
+-- The performance schema database.
+-- Only drop and create the database if this is safe (no broken_pfs).
+-- This database is created, even in --without-perfschema builds,
+-- so that the database name is always reserved by the MySQL implementation.
+--
+
+SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
+
+SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @cmd= "CREATE DATABASE performance_schema character set utf8";
+
+SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- From this point, only create the performance schema tables
+-- if the server is build with performance schema
+--
+
+set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
+
+--
+-- TABLE COND_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.cond_instances(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_CURRENT
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_current(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="EVENT_ID BIGINT unsigned not null,";
+SET @l4="EVENT_NAME VARCHAR(128) not null,";
+SET @l5="SOURCE VARCHAR(64),";
+SET @l6="TIMER_START BIGINT unsigned,";
+SET @l7="TIMER_END BIGINT unsigned,";
+SET @l8="TIMER_WAIT BIGINT unsigned,";
+SET @l9="SPINS INTEGER unsigned,";
+SET @l10="OBJECT_SCHEMA VARCHAR(64),";
+SET @l11="OBJECT_NAME VARCHAR(512),";
+SET @l12="OBJECT_TYPE VARCHAR(64),";
+SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l14="NESTING_EVENT_ID BIGINT unsigned,";
+SET @l15="OPERATION VARCHAR(16) not null,";
+SET @l16="NUMBER_OF_BYTES BIGINT unsigned,";
+SET @l17="FLAGS INTEGER unsigned";
+SET @l18=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_HISTORY
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_history(";
+-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_HISTORY_LONG
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_history_long(";
+-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="COUNT_STAR BIGINT unsigned not null,";
+SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="COUNT_STAR BIGINT unsigned not null,";
+SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_STAR BIGINT unsigned not null,";
+SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.file_instances(";
+SET @l2="FILE_NAME VARCHAR(512) not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="OPEN_COUNT INTEGER unsigned not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_SUMMARY_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_READ BIGINT unsigned not null,";
+SET @l4="COUNT_WRITE BIGINT unsigned not null,";
+SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
+SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
+SET @l7=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_SUMMARY_BY_INSTANCE
+--
+
+SET @l1="CREATE TABLE performance_schema.file_summary_by_instance(";
+SET @l2="FILE_NAME VARCHAR(512) not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="COUNT_READ BIGINT unsigned not null,";
+SET @l5="COUNT_WRITE BIGINT unsigned not null,";
+SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
+SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE MUTEX_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.mutex_instances(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="LOCKED_BY_THREAD_ID INTEGER";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE PERFORMANCE_TIMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.performance_timers(";
+SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,";
+SET @l3="TIMER_FREQUENCY BIGINT,";
+SET @l4="TIMER_RESOLUTION BIGINT,";
+SET @l5="TIMER_OVERHEAD BIGINT";
+SET @l6=") ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE RWLOCK_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.rwlock_instances(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,";
+SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null";
+SET @l6=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_CONSUMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.setup_consumers(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="ENABLED ENUM ('YES', 'NO') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_INSTRUMENTS
+--
+
+SET @l1="CREATE TABLE performance_schema.setup_instruments(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="ENABLED ENUM ('YES', 'NO') not null,";
+SET @l4="TIMED ENUM ('YES', 'NO') not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_TIMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.setup_timers(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE THREADS
+--
+
+SET @l1="CREATE TABLE performance_schema.threads(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="PROCESSLIST_ID INTEGER,";
+SET @l4="NAME VARCHAR(128) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
+
+-- Remember for later if proxies_priv table already existed
+set @had_proxies_priv_table= @@warning_count != 0;
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql
index e82d5412d75..a3b6f6cbfef 100644
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -1,5 +1,4 @@
--- Copyright (c) 2007 MySQL AB, 2008 Sun Microsystems, Inc.
--- Use is subject to license terms.
+-- Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -37,10 +36,17 @@ DROP TABLE tmp_db;
-- from local machine if "users" table didn't exist before
CREATE TEMPORARY TABLE tmp_user LIKE user;
set @current_hostname= @@hostname;
-INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
-REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost';
-REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
+REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost';
+REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
+REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
INSERT INTO tmp_user (host,user) VALUES ('localhost','');
INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
DROP TABLE tmp_user;
+
+CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
+INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
+REPLACE INTO tmp_proxies_priv SELECT @current_hostname, 'root', '', '', TRUE, '', now() FROM DUAL WHERE LOWER (@current_hostname) != 'localhost';
+INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
+DROP TABLE tmp_proxies_priv;
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 09f66c79c3f..38a3e7b2642 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -1,17 +1,17 @@
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-- Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; version 2 of the License.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# This part converts any old privilege tables to privilege tables suitable
# for current version of MySQL
@@ -20,10 +20,6 @@
# because these just mean that your tables are already up to date.
# This script is safe to run even if your tables are already up to date!
-# On unix, you should use the mysql_fix_privilege_tables script to execute
-# this sql script.
-# On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
-
set sql_mode='';
set storage_engine=MyISAM;
@@ -261,6 +257,11 @@ ALTER TABLE slow_log
MODIFY sql_text MEDIUMTEXT NOT NULL;
SET GLOBAL slow_query_log = @old_log_state;
+ALTER TABLE plugin
+ MODIFY name varchar(64) COLLATE utf8_general_ci NOT NULL DEFAULT '',
+ MODIFY dl varchar(128) COLLATE utf8_general_ci NOT NULL DEFAULT '',
+ CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+
#
# Detect whether we had Create_view_priv
#
@@ -378,7 +379,7 @@ ALTER TABLE procs_priv
COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
ALTER TABLE procs_priv
- MODIFY Timestamp timestamp(14) AFTER Proc_priv;
+ MODIFY Timestamp timestamp AFTER Proc_priv;
#
# proc
@@ -493,6 +494,9 @@ ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL
AFTER db_collation;
ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL;
+# Change comment from char(64) to text
+ALTER TABLE proc MODIFY comment
+ text collate utf8_bin NOT NULL;
#
# EVENT privilege
@@ -601,6 +605,54 @@ ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT
UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
+#
+# user.Create_tablespace_priv
+#
+
+SET @hadCreateTablespacePriv := 0;
+SELECT @hadCreateTablespacePriv :=1 FROM user WHERE Create_tablespace_priv LIKE '%';
+
+ALTER TABLE user ADD Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Trigger_priv;
+ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Trigger_priv;
+
+UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;
+
+--
+-- Unlike 'performance_schema', the 'mysql' database is reserved already,
+-- so no user procedure is supposed to be there.
+--
+-- NOTE: until upgrade is finished, stored routines are not available,
+-- because system tables (e.g. mysql.proc) might be not usable.
+--
+drop procedure if exists mysql.die;
+create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.';
+
+--
+-- For broken upgrades, SIGNAL the error
+--
+
+SET @cmd="call mysql.die()";
+
+SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+drop procedure mysql.die;
+
+ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT;
+ALTER TABLE user MODIFY plugin char(64) DEFAULT '';
+ALTER TABLE user MODIFY authentication_string TEXT;
+
+-- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
+-- older versions
+
+CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
+INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
+INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
+DROP TABLE tmp_proxies_priv;
+
+
# Activate the new, possible modified privilege tables
# This should not be needed, but gives us some extra testing that the above
# changes was correct
diff --git a/scripts/mysqlaccess.conf b/scripts/mysqlaccess.conf
index faf47da5f6c..faf47da5f6c 100644..100755
--- a/scripts/mysqlaccess.conf
+++ b/scripts/mysqlaccess.conf
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 8a4d0d44203..fb6475b7406 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -76,20 +76,6 @@ sub main
push @defaults_options, (shift @ARGV);
}
- # Handle deprecated --config-file option: convert to --defaults-extra-file
- foreach my $arg (@ARGV)
- {
- if ($arg =~ m/^--config-file=(.*)/)
- {
- # Put it at the beginning of the list, so it has lower precedence
- # than a correct --defaults-extra-file option
-
- unshift @defaults_options, "--defaults-extra-file=$1";
- print "WARNING: --config-file is deprecated and will be removed\n";
- print "in MySQL 5.6. Please use --defaults-extra-file instead\n";
- }
- }
-
foreach (@defaults_options)
{
$_ = quote_shell_word($_);
@@ -98,11 +84,6 @@ sub main
# Add [mysqld_multi] options to front of @ARGV, ready for GetOptions()
unshift @ARGV, defaults_for_group('mysqld_multi');
- # The --config-file option can be ignored; if passed on the command
- # line, it's already handled; if specified in the configuration file,
- # it's redundant and not useful
- @ARGV= grep { not /^--config-file=/ } @ARGV;
-
# We've already handled --no-defaults, --defaults-file, etc.
if (!GetOptions("help", "example", "version", "mysqld=s", "mysqladmin=s",
"user=s", "password=s", "log=s", "no-log",
@@ -759,8 +740,8 @@ from both [mysqld_multi] and [mysqld#], a group that is tried to be
used, $my_progname will abort with an error.
$my_progname will search for groups named [mysqld#] from my.cnf (or
-the given --config-file=...), where '#' can be any positive integer
-starting from 1. These groups should be the same as the regular
+the given --defaults-extra-file=...), where '#' can be any positive
+integer starting from 1. These groups should be the same as the regular
[mysqld] group, but with those port, socket and any other options
that are to be used with each separate mysqld process. The number
in the group name has another function; it can be used for starting,
@@ -786,7 +767,6 @@ These options must be given before any others:
standard system-wide and user-specific files
Using: @{[join ' ', @defaults_options]}
---config-file=... Deprecated, please use --defaults-extra-file instead
--example Give an example of a config file with extra information.
--help Print this help and exit.
--log=... Log file. Full path to and the name for the log file. NOTE:
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index e4e5f1a1510..a537bf27aad 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -11,9 +11,13 @@
# mysql.server works by first doing a cd to the base directory and from there
# executing mysqld_safe
+# Initialize script globals
KILL_MYSQLD=1;
MYSQLD=
niceness=0
+mysqld_ld_preload=
+mysqld_ld_library_path=
+
# Initial logging status: error log is not open, and not using syslog
logging=init
want_syslog=0
@@ -46,9 +50,12 @@ Usage: $0 [OPTIONS]
--open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
--timezone=TZ Set the system timezone
+ --malloc-lib=LIB Preload shared library LIB if available
--mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld
+ --plugin-dir=DIR Plugins are under DIR or DIR/VERSION, if
+ VERSION is given
--skip-kill-mysqld Don't try to kill stray mysqld processes
--syslog Log messages to syslog with 'logger'
--skip-syslog Log messages to error log (default)
@@ -155,12 +162,19 @@ parse_arguments() {
fi
for arg do
- val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
+ # the parameter after "=", or the whole $arg if no match
+ val=`echo "$arg" | sed -e 's;^--[^=]*=;;'`
+ # what's before "=", or the whole $arg if no match
+ optname=`echo "$arg" | sed -e 's/^\(--[^=]*\)=.*$/\1/'`
+ # replace "_" by "-" ; mysqld_safe must accept "_" like mysqld does.
+ optname_subst=`echo "$optname" | sed 's/_/-/g'`
+ arg=`echo $arg | sed "s/^$optname/$optname_subst/"`
case "$arg" in
# these get passed explicitly to mysqld
--basedir=*) MY_BASEDIR_VERSION="$val" ;;
--datadir=*) DATADIR="$val" ;;
--pid-file=*) pid_file="$val" ;;
+ --plugin-dir=*) PLUGIN_DIR="$val" ;;
--user=*) user="$val"; SET_USER=1 ;;
# these might have been set in a [mysqld_safe] section of my.cnf
@@ -172,11 +186,13 @@ parse_arguments() {
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
--core-file-size=*) core_file_size="$val" ;;
--ledir=*) ledir="$val" ;;
+ --malloc-lib=*) set_malloc_lib "$val" ;;
--mysqld=*) MYSQLD="$val" ;;
--mysqld-version=*)
if test -n "$val"
then
MYSQLD="mysqld-$val"
+ PLUGIN_VARIANT="/$val"
else
MYSQLD="mysqld"
fi
@@ -203,6 +219,131 @@ parse_arguments() {
}
+# Add a single shared library to the list of libraries which will be added to
+# LD_PRELOAD for mysqld
+#
+# Since LD_PRELOAD is a space-separated value (for historical reasons), if a
+# shared lib's path contains spaces, that path will be prepended to
+# LD_LIBRARY_PATH and stripped from the lib value.
+add_mysqld_ld_preload() {
+ lib_to_add="$1"
+ log_notice "Adding '$lib_to_add' to LD_PRELOAD for mysqld"
+
+ case "$lib_to_add" in
+ *' '*)
+ # Must strip path from lib, and add it to LD_LIBRARY_PATH
+ lib_file=`basename "$lib_to_add"`
+ case "$lib_file" in
+ *' '*)
+ # The lib file itself has a space in its name, and can't
+ # be used in LD_PRELOAD
+ log_error "library name '$lib_to_add' contains spaces and can not be used with LD_PRELOAD"
+ exit 1
+ ;;
+ esac
+ lib_path=`dirname "$lib_to_add"`
+ lib_to_add="$lib_file"
+ [ -n "$mysqld_ld_library_path" ] && mysqld_ld_library_path="$mysqld_ld_library_path:"
+ mysqld_ld_library_path="$mysqld_ld_library_path$lib_path"
+ ;;
+ esac
+
+ # LD_PRELOAD is a space-separated
+ [ -n "$mysqld_ld_preload" ] && mysqld_ld_preload="$mysqld_ld_preload "
+ mysqld_ld_preload="${mysqld_ld_preload}$lib_to_add"
+}
+
+
+# Returns LD_PRELOAD (and LD_LIBRARY_PATH, if needed) text, quoted to be
+# suitable for use in the eval that calls mysqld.
+#
+# All values in mysqld_ld_preload are prepended to LD_PRELOAD.
+mysqld_ld_preload_text() {
+ text=
+
+ if [ -n "$mysqld_ld_preload" ]; then
+ new_text="$mysqld_ld_preload"
+ [ -n "$LD_PRELOAD" ] && new_text="$new_text $LD_PRELOAD"
+ text="${text}LD_PRELOAD="`shell_quote_string "$new_text"`' '
+ fi
+
+ if [ -n "$mysqld_ld_library_path" ]; then
+ new_text="$mysqld_ld_library_path"
+ [ -n "$LD_LIBRARY_PATH" ] && new_text="$new_text:$LD_LIBRARY_PATH"
+ text="${text}LD_LIBRARY_PATH="`shell_quote_string "$new_text"`' '
+ fi
+
+ echo "$text"
+}
+
+
+mysql_config=
+get_mysql_config() {
+ if [ -z "$mysql_config" ]; then
+ mysql_config=`echo "$0" | sed 's,/[^/][^/]*$,/mysql_config,'`
+ if [ ! -x "$mysql_config" ]; then
+ log_error "Can not run mysql_config $@ from '$mysql_config'"
+ exit 1
+ fi
+ fi
+
+ "$mysql_config" "$@"
+}
+
+
+# set_malloc_lib LIB
+# - If LIB is empty, do nothing and return
+# - If LIB is 'tcmalloc', look for tcmalloc shared library in /usr/lib
+# then pkglibdir. tcmalloc is part of the Google perftools project.
+# - If LIB is an absolute path, assume it is a malloc shared library
+#
+# Put LIB in mysqld_ld_preload, which will be added to LD_PRELOAD when
+# running mysqld. See ld.so for details.
+set_malloc_lib() {
+ malloc_lib="$1"
+
+ if [ "$malloc_lib" = tcmalloc ]; then
+ pkglibdir=`get_mysql_config --variable=pkglibdir`
+ malloc_lib=
+ # This list is kept intentionally simple. Simply set --malloc-lib
+ # to a full path if another location is desired.
+ for libdir in /usr/lib "$pkglibdir" "$pkglibdir/mysql"; do
+ for flavor in _minimal '' _and_profiler _debug; do
+ tmp="$libdir/libtcmalloc$flavor.so"
+ #log_notice "DEBUG: Checking for malloc lib '$tmp'"
+ [ -r "$tmp" ] || continue
+ malloc_lib="$tmp"
+ break 2
+ done
+ done
+
+ if [ -z "$malloc_lib" ]; then
+ log_error "no shared library for --malloc-lib=tcmalloc found in /usr/lib or $pkglibdir"
+ exit 1
+ fi
+ fi
+
+ # Allow --malloc-lib='' to override other settings
+ [ -z "$malloc_lib" ] && return
+
+ case "$malloc_lib" in
+ /*)
+ if [ ! -r "$malloc_lib" ]; then
+ log_error "--malloc-lib '$malloc_lib' can not be read and will not be used"
+ exit 1
+ fi
+ ;;
+ *)
+ log_error "--malloc-lib must be an absolute path or 'tcmalloc'; " \
+ "ignoring value '$malloc_lib'"
+ exit 1
+ ;;
+ esac
+
+ add_mysqld_ld_preload "$malloc_lib"
+}
+
+
#
# First, try to find BASEDIR and ledir (where mysqld is)
#
@@ -225,6 +366,9 @@ then
if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
then
ledir="$MY_BASEDIR_VERSION/libexec"
+ elif test -x "$MY_BASEDIR_VERSION/sbin/mysqld"
+ then
+ ledir="$MY_BASEDIR_VERSION/sbin"
else
ledir="$MY_BASEDIR_VERSION/bin"
fi
@@ -237,6 +381,10 @@ elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
then
MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
ledir="$MY_PWD/libexec" # Where mysqld is
+elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/sbin/mysqld"
+then
+ MY_BASEDIR_VERSION="$MY_PWD" # Where sbin, share and var are
+ ledir="$MY_PWD/sbin" # Where mysqld is
# Since we didn't find anything, used the compiled-in defaults
else
MY_BASEDIR_VERSION='@prefix@'
@@ -265,6 +413,29 @@ else
DATADIR=@localstatedir@
fi
+#
+# Try to find the plugin directory
+#
+
+# Use user-supplied argument
+if [ -n "${PLUGIN_DIR}" ]; then
+ plugin_dir="${PLUGIN_DIR}"
+else
+ # Try to find plugin dir relative to basedir
+ for dir in lib/mysql/plugin lib/plugin
+ do
+ if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
+ plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
+ break
+ fi
+ done
+ # Give up and use compiled-in default
+ if [ -z "${plugin_dir}" ]; then
+ plugin_dir='@pkgplugindir@'
+ fi
+fi
+plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
+
if test -z "$MYSQL_HOME"
then
if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
@@ -554,10 +725,10 @@ fi
# ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems
#fi
-cmd="$NOHUP_NICENESS"
+cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
- "--datadir=$DATADIR" "$USER_OPTION"
+ "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
do
cmd="$cmd "`shell_quote_string "$i"`
done
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index df6cb9b43dc..aaa77ec181c 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -73,6 +73,8 @@ Usage: $0 db_name[./table_regex/] [new_db_name | directory]
-h, --host=# hostname for local server when connecting over TCP/IP
-P, --port=# port to use when connecting to local server with TCP/IP
-S, --socket=# socket to use when connecting to local server
+ --old_server connect to old MySQL-server (before v5.5) which
+ doesn't have FLUSH TABLES WITH READ LOCK fully implemented.
--allowold don\'t abort if target dir already exists (rename it _old)
--addtodest don\'t rename target dir if it exists, just add files to it
@@ -120,6 +122,7 @@ GetOptions( \%opt,
"password|p=s",
"port|P=s",
"socket|S=s",
+ "old_server",
"allowold!",
"keepold!",
"addtodest!",
@@ -248,10 +251,6 @@ elsif (defined($tgt_name) && ($tgt_name =~ m:/: || $tgt_name eq '.')) {
elsif ( $opt{suffix} ) {
print "Using copy suffix '$opt{suffix}'\n" unless $opt{quiet};
}
-elsif ( ($^O =~ m/^(NetWare)$/) && defined($tgt_name) && ($tgt_name =~ m:\\: || $tgt_name eq '.'))
-{
- $tgt_dirname = $tgt_name;
-}
else
{
$tgt_name="" if (!defined($tgt_name));
@@ -437,11 +436,8 @@ foreach my $rdb ( @db_desc ) {
else {
mkdir($tgt_dirpath, 0750) or die "Can't create '$tgt_dirpath': $!\n"
unless -d $tgt_dirpath;
- if ($^O !~ m/^(NetWare)$/)
- {
- my @f_info= stat "$datadir/$rdb->{src}";
- chown $f_info[4], $f_info[5], $tgt_dirpath;
- }
+ my @f_info= stat "$datadir/$rdb->{src}";
+ chown $f_info[4], $f_info[5], $tgt_dirpath;
}
}
@@ -466,21 +462,37 @@ if ( $opt{checkpoint} || $opt{record_log_pos} ) {
my $hc_started = time; # count from time lock is granted
if ( $opt{dryrun} ) {
- print "LOCK TABLES $hc_locks\n";
- print "FLUSH TABLES /*!32323 $hc_tables */\n";
+ if ( $opt{old_server} ) {
+ print "LOCK TABLES $hc_locks\n";
+ print "FLUSH TABLES /*!32323 $hc_tables */\n";
+ }
+ else {
+ print "FLUSH TABLES $hc_tables WITH READ LOCK\n";
+ }
+
print "FLUSH LOGS\n" if ( $opt{flushlog} );
print "RESET MASTER\n" if ( $opt{resetmaster} );
print "RESET SLAVE\n" if ( $opt{resetslave} );
}
else {
my $start = time;
- $dbh->do("LOCK TABLES $hc_locks");
- printf "Locked $num_tables tables in %d seconds.\n", time-$start unless $opt{quiet};
- $hc_started = time; # count from time lock is granted
+ if ( $opt{old_server} ) {
+ $dbh->do("LOCK TABLES $hc_locks");
+ printf "Locked $num_tables tables in %d seconds.\n", time-$start unless $opt{quiet};
+ $hc_started = time; # count from time lock is granted
+
+ # flush tables to make on-disk copy up to date
+ $start = time;
+ $dbh->do("FLUSH TABLES /*!32323 $hc_tables */");
+ }
+ else {
+ $dbh->do("FLUSH TABLES $hc_tables WITH READ LOCK");
+ printf "Locked $num_tables tables in %d seconds.\n", time-$start unless $opt{quiet};
+ $hc_started = time; # count from time lock is granted
- # flush tables to make on-disk copy up to date
- $start = time;
- $dbh->do("FLUSH TABLES /*!32323 $hc_tables */");
+ # flush tables to make on-disk copy up to date
+ $start = time;
+ }
printf "Flushed tables ($hc_tables) in %d seconds.\n", time-$start unless $opt{quiet};
$dbh->do( "FLUSH LOGS" ) if ( $opt{flushlog} );
$dbh->do( "RESET MASTER" ) if ( $opt{resetmaster} );
@@ -596,14 +608,7 @@ sub copy_files {
my @cmd;
print "Copying ".@$files." files...\n" unless $opt{quiet};
- if ($^O =~ m/^(NetWare)$/) # on NetWare call PERL copy (slower)
- {
- foreach my $file ( @$files )
- {
- copy($file, $target."/".basename($file));
- }
- }
- elsif ($method =~ /^s?cp\b/) # cp or scp with optional flags
+ if ($method =~ /^s?cp\b/) # cp or scp with optional flags
{
my $cp = $method;
# add option to preserve mod time etc of copied files
@@ -1000,6 +1005,10 @@ when using the --host option.
UNIX domain socket to use when connecting to local server.
+=item --old_server
+
+Use old server (pre v5.5) commands.
+
=item --noindices
Don\'t include index files in copy. Only up to the first 2048 bytes