diff options
Diffstat (limited to 'scripts')
25 files changed, 1623 insertions, 1103 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 d0cbafccc82..a454313d966 100755..100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006, 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 @@ -11,86 +11,356 @@ # # 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 +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# Build mysql_fix_privilege_tables.sql -FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql +# Build comp_sql - used for embedding SQL in C or C++ programs +IF(NOT CMAKE_CROSSCOMPILING) + ADD_EXECUTABLE(comp_sql comp_sql.c) + TARGET_LINK_LIBRARIES(comp_sql) +ENDIF() + + +# 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() + +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 ) -ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables.sql - 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} - DEPENDS - ${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables.sql - ${PROJECT_SOURCE_DIR}/scripts/mysql_system_tables_fix.sql) + 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() -# 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) - -# Use comp_sql to build mysql_fix_privilege_tables_sql.c -GET_TARGET_PROPERTY(COMP_SQL_EXE comp_sql LOCATION) - -ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables_sql.c - COMMAND ${COMP_SQL_EXE} - mysql_fix_privilege_tables - ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql - mysql_fix_privilege_tables_sql.c - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS comp_sql - ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables.sql) - -# 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 ${CMAKE_BINARY_DIR}/scripts/mysql_fix_privilege_tables_sql.c) - -# ---------------------------------------------------------------------- -# Replace some variables @foo@ in the .in/.sh file, and write the new script -# ---------------------------------------------------------------------- - -SET(CFLAGS "-D_WINDOWS ${CMAKE_C_FLAGS_RELWITHDEBINFO}") -SET(prefix "${CMAKE_INSTALL_PREFIX}") -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) - -CONFIGURE_FILE(mysql_config.pl.in - ${CMAKE_BINARY_DIR}/scripts/mysql_config.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mysql_convert_table_format.sh - ${CMAKE_BINARY_DIR}/scripts/mysql_convert_table_format.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mysql_install_db.pl.in - ${CMAKE_BINARY_DIR}/scripts/mysql_install_db.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mysql_secure_installation.pl.in - ${CMAKE_BINARY_DIR}/scripts/mysql_secure_installation.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mysqld_multi.sh - ${CMAKE_BINARY_DIR}/scripts/mysqld_multi.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mysqldumpslow.sh - ${CMAKE_BINARY_DIR}/scripts/mysqldumpslow.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mysqlhotcopy.sh - ${CMAKE_BINARY_DIR}/scripts/mysqlhotcopy.pl ESCAPE_QUOTES @ONLY) - -CONFIGURE_FILE(mytop.sh - ${CMAKE_BINARY_DIR}/scripts/mytop.pl ESCAPE_QUOTES @ONLY) - -FOREACH(f mysqldumpslow.pl mysqlhotcopy.pl mytop.pl mysql_config.pl - mysql_convert_table_format.pl mysql_install_db.pl - mysql_secure_installation.pl mysqld_multi.pl) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} - DESTINATION scripts COMPONENT Server_Scripts) -ENDFOREACH() - -INSTALL(FILES fill_help_tables.sql mysql_system_tables.sql - mysql_system_tables_data.sql mysql_system_tables_fix.sql mysql_test_data_timezone.sql - DESTINATION share COMPONENT Server) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql DESTINATION share COMPONENT Server) + 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\n" ) + 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) +INSTALL_SCRIPT( + "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db" + DESTINATION ${DEST} + COMPONENT Server + ) +ENDIF() + + +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) + +# mysql_config evaluates ${LIBDL}, we want to avoid it +# as our CLIENT_LIBS and LIBS are already correct +SET(LIBDL) + +SET(NON_THREADED_LIBS ${CLIENT_LIBS}) +SET(mysql_config_COMPONENT COMPONENT Development) + +IF(WIN32) + # On Windows, some .sh and some .pl.in files are configured + # The resulting files will have .pl extension (those are perl scripts) + + # Input files with pl.in extension + SET(PLIN_FILES mysql_config mysql_secure_installation) + # Input files with .sh extension + + SET(SH_FILES mysql_convert_table_format mysqld_multi mysqldumpslow + mysqlhotcopy) + + 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() + + 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() + +# 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() + diff --git a/scripts/Makefile.am b/scripts/Makefile.am deleted file mode 100644 index 66f2b0165fa..00000000000 --- a/scripts/Makefile.am +++ /dev/null @@ -1,204 +0,0 @@ -# Copyright (c) 2000, 2010, Oracle and/or its affiliates -# -# 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 \ - mytop \ - mysqldumpslow \ - mysqld_multi - -noinst_SCRIPTS = make_binary_distribution \ - make_sharedlib_distribution \ - convert-debug-for-diff - -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 \ - mytop.sh \ - mysqldumpslow.sh \ - mysqld_multi.sh \ - mysqld_safe.sh \ - convert-debug-for-diff.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 \ - mytop \ - mysqldumpslow \ - mysqld_multi \ - convert-debug-for-diff \ - $(EXTRA_PROGRAMS) - -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 $@"; - @echo "-- This file is automaticly generated from" > $@ - @echo "-- mysql_system_tables.sql & mysql_system_tables_fix.sql" >> $@ - @echo "" >> $@ - @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 $@ diff --git a/scripts/convert-debug-for-diff.sh b/scripts/convert-debug-for-diff.sh index b6c837504cb..5b3ce05b815 100755 --- a/scripts/convert-debug-for-diff.sh +++ b/scripts/convert-debug-for-diff.sh @@ -1,7 +1,7 @@ #!/usr/bin/perl -i # # This script converts all numbers that look like addresses or memory sizes, -# in a debug files generated by --debug (like mysqld --debug), to #. +# in a debug files generated by --debug (like mysqld --debug-dbug), to #. # The script also deletes all thread id's from the start of the line. # This allows you to easily compare the files (for example with diff) 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/fill_help_tables.sql b/scripts/fill_help_tables.sql index 30d30328e3d..7751c37cbc3 100644 --- a/scripts/fill_help_tables.sql +++ b/scripts/fill_help_tables.sql @@ -1,4 +1,5 @@ --- Copyright (C) 2005 MySQL AB +-- Copyright (c) 2003, &year, Oracle and/or its affiliates. All rights reserved. +-- Copyright (C) 2011 Monty Program 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 diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 070b396a34c..053abb33b2c 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2000-2006 MySQL AB +# 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 @@ -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@ @@ -225,367 +223,164 @@ fi # ############################################################################## -if [ x"$BASE_SYSTEM" != x"netware" ] ; then - - # ---------------------------------------------------------------------- - # Terminate on any base level error - # ---------------------------------------------------------------------- - set -e - - # - # Check that the client is compiled with libmysqlclient.a - # - if test -f ./client/.libs/mysql - then - echo "" - echo "The MySQL clients are compiled dynamicly, which is not allowed for" - echo "a MySQL binary tar file. Please configure with" - echo "--with-client-ldflags=-all-static and try again" - 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. - # ---------------------------------------------------------------------- - - cd scripts - rm -f mysql_install_db mysqld_safe mysql_fix_privilege_tables - @MAKE@ mysql_install_db mysqld_safe mysql_fix_privilege_tables \ - 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=./share - 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@ \ - libexecdir=@prefix@/libexec - - # ---------------------------------------------------------------------- - # 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 - { - mkdir -p $DEST/lib - $CP $gcclib $DEST/lib/libmygcc.a - } - else - echo "Warning: Compiler result '$gcclib' not found / no file!" - fi - fi - - # Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 - - # Copy readme and license files - cp README Docs/INSTALL-BINARY $DEST/ - if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then - cp COPYING EXCEPTIONS-CLIENT $DEST/ - elif [ -f LICENSE.mysql ] ; then - cp LICENSE.mysql $DEST/ - else - echo "ERROR: no license files found" - exit 1 - fi - - # 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/ - - # 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 +# ---------------------------------------------------------------------- +# Terminate on any base level error +# ---------------------------------------------------------------------- +set -e - # Remove not needed files - rm $DEST/share/mysql/errmsg.txt +# +# Check that the client is compiled with libmysqlclient.a +# +if test -f ./client/.libs/mysql +then + echo "" + echo "The MySQL clients are compiled dynamicly, which is not allowed for" + echo "a MySQL binary tar file. Please configure with" + echo "--with-client-ldflags=-all-static and try again" + exit 1; +fi - # Remove NDB files - rm -f $DEST/share/mysql/ndb-config-2-node.ini \ - $DEST/share/mysql/config* +# ---------------------------------------------------------------------- +# 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. +# ---------------------------------------------------------------------- - # - # Move things to make them easier to find in tar installation - # +cd scripts +rm -f mysql_install_db mysqld_safe mysql_fix_privilege_tables +@MAKE@ mysql_install_db mysqld_safe mysql_fix_privilege_tables \ + 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=./share +cd .. - # The following test is needed if the original configure was done with - # something like --libexecdir=/usr/local/mysql/bin - if test -f $DEST/libexec/mysqld - then - mv $DEST/libexec/* $DEST/bin - rmdir $DEST/libexec - fi - mv $DEST/share/man $DEST - mv $DEST/share/mysql/binary-configure $DEST/configure - mv $DEST/share/mysql/*.sql $DEST/share - mv $DEST/share/mysql/*.cnf $DEST/share/mysql/*.server $DEST/share/mysql/mysql-log-rotate $DEST/support-files - - # - # Move some scripts that are only run once to 'scripts' directory - # but add symbolic links instead to old place for compatibility - # - mkdir $DEST/scripts - for i in mysql_secure_installation mysql_fix_extensions mysql_fix_privilege_tables mysql_install_db - do - mv $DEST/bin/$i $DEST/scripts - ln -s "../scripts/$i" $DEST/bin/$i - done +# ---------------------------------------------------------------------- +# 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 \ + libexecdir=@prefix@/libexec \ + 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 +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 +# 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 +# Note, no legacy "safe_mysqld" link to "mysqld_safe" in 5.1 -############################################################################## -# -# Handle the Netware case, until integrated above -# -############################################################################## +# Copy readme and license files +cp README Docs/INSTALL-BINARY $DEST/ +if [ -f COPYING -a -f EXCEPTIONS-CLIENT ] ; then + cp COPYING EXCEPTIONS-CLIENT $DEST/ +elif [ -f LICENSE.mysql ] ; then + cp LICENSE.mysql $DEST/ +else + echo "ERROR: no license files found" + exit 1 +fi -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 -} +# 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/ -copyfileto $BASE/docs ChangeLog Docs/mysql.info - -copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - EXCEPTIONS-CLIENT 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 \ - storage/maria/aria_chk$BS storage/maria/aria_pack$BS \ - storage/maria/aria_ftdump$BS storage/maria/aria_read_log$BS \ - storage/maria/aria_dump_log$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 \ - storage/pbxt/bin/xtstat$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 -$CP scripts/mytop $BASE/scripts/mytop.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 -fi +# 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 -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 \ - $BASE/share/mysql/errmsg.txt +# Remove not needed files +rm $DEST/share/mysql/errmsg.txt # Remove NDB files -rm -f $BASE/share/ndb-config-2-node.ini \ - $BASE/share/mysql/config* +rm -f $DEST/share/mysql/ndb-config-2-node.ini \ + $DEST/share/mysql/config* # -# Move things to make things easier to find in tar installation +# Move things to make them easier to find in tar installation # -mv $BASE/share/man $BASE -mv $BASE/share/mysql/binary-configure $BASE/configure -mv $BASE/share/mysql/*.sql $BASE/share -mv $BASE/share/mysql/*.cnf $BASE/share/mysql/*.server $BASE/share/mysql/mysql-log-rotate $BASE/support-files +# The following test is needed if the original configure was done with +# something like --libexecdir=/usr/local/mysql/bin +if test -f $DEST/libexec/mysqld +then + mv $DEST/libexec/* $DEST/bin + rmdir $DEST/libexec +fi +mv $DEST/share/man $DEST +mv $DEST/share/mysql/binary-configure $DEST/configure +mv $DEST/share/mysql/*.sql $DEST/share +mv $DEST/share/mysql/*.cnf $DEST/share/mysql/*.server $DEST/share/mysql/mysql-log-rotate $DEST/support-files # -# Remove system dependent files +# Move some scripts that are only run once to 'scripts' directory +# but add symbolic links instead to old place for compatibility # -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 - -BASE2=$TMP/$NEW_NAME -rm -rf $BASE2 -mv $BASE $BASE2 -BASE=$BASE2 +mkdir $DEST/scripts +for i in mysql_secure_installation mysql_fix_extensions mysql_fix_privilege_tables mysql_install_db mytop +do + mv $DEST/bin/$i $DEST/scripts + ln -s "../scripts/$i" $DEST/bin/$i +done -# -# 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" +# ---------------------------------------------------------------------- +# Create the result tar file +# ---------------------------------------------------------------------- + +echo "Using $tar to create archive" +OPT=cvf +if [ x$SILENT = x1 ] ; then + OPT=cf +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 + 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 6a782c09cdb..a6bf73ca0fe 100755 --- a/scripts/make_win_bin_dist +++ b/scripts/make_win_bin_dist @@ -163,9 +163,7 @@ if [ -f "storage/pbxt/bin/xtstat.exe" ] ; then cp storage/pbxt/bin/xtstat.{exe,pdb} $DESTDIR/bin fi -cp server-tools/instance-manager/$TARGET/*.exe $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/ @@ -269,12 +267,13 @@ 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 \ include/my_dir.h \ include/sslopt-vars.h \ - include/sslopt-case.h \ + 'include/sslopt-case.h' \ include/sql_common.h \ include/keycache.h \ include/m_ctype.h \ @@ -284,7 +283,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/ @@ -402,8 +400,8 @@ rm -rf `/bin/find $DISTDIR -type d -name SCCS -print` # ---------------------------------------------------------------------- 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 f8d50284e31..acf33699b05 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_valgrind 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 ce61c09aa15..fd15d7ac746 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 lib64/mysql lib64 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_valgrind 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_extensions.sh b/scripts/mysql_fix_extensions.sh index ae3ac4ced76..2a50bfe22bb 100644 --- a/scripts/mysql_fix_extensions.sh +++ b/scripts/mysql_fix_extensions.sh @@ -1,4 +1,5 @@ #!/usr/bin/perl + # Copyright (c) 2001 MySQL AB, 2009 Sun Microsystems, Inc. # Use is subject to license terms. # diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh deleted file mode 100644 index f0147b22878..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 ./extra ./bin @bindir@ @bindir@ $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 client client-server client-mariadb 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 "$dirname/../client" $basedir/bin @bindir@ - 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 "$dirname" $basedir/support-files $basedir/share \ - $basedir/share/mysql $basedir/scripts $pkgdatadir . -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 de40c4be63b..f0b09cc3e77 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -56,7 +56,7 @@ Usage: $0 [OPTIONS] --help Display this help and exit. --ldata=path The path to the MariaDB data directory. Same as --datadir. - --no-defaults Don't read any configuration files (my.cnf). + --no-defaults Don't read default options from any option file. --defaults-file=path Read only this configuration file. --rpm For internal use. This option is used by RPM files during the MariaDB installation process. @@ -330,7 +330,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 @@ -381,9 +381,15 @@ do fi 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_setpermission.sh b/scripts/mysql_setpermission.sh index 8933fc9101d..f23011a5ae6 100644 --- a/scripts/mysql_setpermission.sh +++ b/scripts/mysql_setpermission.sh @@ -1,5 +1,6 @@ #!/usr/bin/perl ## Emacs, this is -*- perl -*- mode? :-) + # Copyright (c) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc. # Use is subject to license terms. # diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 05cbc401612..eaf4fda4026 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -5,12 +5,12 @@ -- 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,8 +29,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) DEFAULT 0 NOT NULL, plugin char(60) CHARACTER SET latin1 DEFAULT '' NOT NULL, auth_string TEXT 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) DEFAULT 0 NOT NULL, plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, authentication_string TEXT NOT NULL, 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; @@ -39,7 +38,7 @@ 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'; @@ -76,8 +75,7 @@ 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', 'IGNORE_BAD_TABLE_OPTIONS', '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', 'IGNORE_BAD_TABLE_OPTIONS', '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, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; @@ -102,6 +100,389 @@ 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; + CREATE TABLE IF NOT EXISTS table_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables'; CREATE TABLE IF NOT EXISTS column_stat (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varchar(255) DEFAULT NULL, max_value varchar(255) DEFAULT NULL, nulls_ratio double DEFAULT NULL, avg_length double DEFAULT NULL, avg_frequency double DEFAULT NULL, PRIMARY KEY (db_name,table_name,column_name) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns'; diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index 583c44fe51c..878555e9458 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -37,10 +37,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 89e2caf7975..cc697092e6e 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -1,17 +1,18 @@ -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. -# -# 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. +-- Copyright (C) 2010, 2011 Monty Program 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 part converts any old privilege tables to privilege tables suitable # for current version of MySQL @@ -20,10 +21,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 +258,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 # @@ -496,6 +498,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 @@ -604,8 +609,53 @@ ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; -ALTER TABLE user ADD plugin char(60) CHARACTER SET latin1 DEFAULT '' NOT NULL, ADD auth_string TEXT NOT NULL; -ALTER TABLE user MODIFY plugin char(60) CHARACTER SET latin1 DEFAULT '' NOT NULL; +# +# 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) CHARACTER SET latin1 DEFAULT '' NOT NULL; +ALTER TABLE user MODIFY authentication_string TEXT NOT NULL; + +-- 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 diff --git a/scripts/mysql_test_data_timezone.sql b/scripts/mysql_test_data_timezone.sql index e52df2149f2..6bf28148e5e 100644 --- a/scripts/mysql_test_data_timezone.sql +++ b/scripts/mysql_test_data_timezone.sql @@ -1,3 +1,18 @@ +-- Copyright (C) 2007 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5); INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1) ,(1, -1663455600, 2) ,(1, -1650150000, 3) ,(1, -1632006000, 2) ,(1, -1618700400, 3) ,(1, -938905200, 2) ,(1, -857257200, 3) ,(1, -844556400, 2) ,(1, -828226800, 3) ,(1, -812502000, 2) ,(1, -796777200, 3) ,(1, 228877200, 2) ,(1, 243997200, 3) ,(1, 260326800, 2) ,(1, 276051600, 3) ,(1, 291776400, 2) ,(1, 307501200, 3) ,(1, 323830800, 2) ,(1, 338950800, 3) ,(1, 354675600, 2) ,(1, 370400400, 3) ,(1, 386125200, 2) ,(1, 401850000, 3) ,(1, 417574800, 2) ,(1, 433299600, 3) ,(1, 449024400, 2) ,(1, 465354000, 3) ,(1, 481078800, 2) ,(1, 496803600, 3) ,(1, 512528400, 2) ,(1, 528253200, 3) ,(1, 543978000, 2) ,(1, 559702800, 3) ,(1, 575427600, 2) ,(1, 591152400, 3) ,(1, 606877200, 2) ,(1, 622602000, 3) ,(1, 638326800, 2) ,(1, 654656400, 3) ,(1, 670381200, 2) ,(1, 686106000, 3) ,(1, 701830800, 2) ,(1, 717555600, 3) ,(1, 733280400, 2) ,(1, 749005200, 3) ,(1, 764730000, 2) ,(1, 780454800, 3) ,(1, 796179600, 2) ,(1, 811904400, 3) ,(1, 828234000, 2) ,(1, 846378000, 3) ,(1, 859683600, 2) ,(1, 877827600, 3) ,(1, 891133200, 2) ,(1, 909277200, 3) ,(1, 922582800, 2) ,(1, 941331600, 3) ,(1, 954032400, 2) ,(1, 972781200, 3) ,(1, 985482000, 2) ,(1, 1004230800, 3) ,(1, 1017536400, 2) ,(1, 1035680400, 3) ,(1, 1048986000, 2) ,(1, 1067130000, 3) ,(1, 1080435600, 2) ,(1, 1099184400, 3) ,(1, 1111885200, 2) ,(1, 1130634000, 3) ,(1, 1143334800, 2) ,(1, 1162083600, 3) ,(1, 1174784400, 2) ,(1, 1193533200, 3) ,(1, 1206838800, 2) ,(1, 1224982800, 3) ,(1, 1238288400, 2) ,(1, 1256432400, 3) ,(1, 1269738000, 2) ,(1, 1288486800, 3) ,(1, 1301187600, 2) ,(1, 1319936400, 3) ,(1, 1332637200, 2) ,(1, 1351386000, 3) ,(1, 1364691600, 2) ,(1, 1382835600, 3) ,(1, 1396141200, 2) ,(1, 1414285200, 3) ,(1, 1427590800, 2) ,(1, 1445734800, 3) ,(1, 1459040400, 2) ,(1, 1477789200, 3) ,(1, 1490490000, 2) ,(1, 1509238800, 3) ,(1, 1521939600, 2) ,(1, 1540688400, 3) ,(1, 1553994000, 2) ,(1, 1572138000, 3) ,(1, 1585443600, 2) ,(1, 1603587600, 3) ,(1, 1616893200, 2) ,(1, 1635642000, 3) ,(1, 1648342800, 2) ,(1, 1667091600, 3) ,(1, 1679792400, 2) ,(1, 1698541200, 3) ,(1, 1711846800, 2) ,(1, 1729990800, 3) ,(1, 1743296400, 2) ,(1, 1761440400, 3) ,(1, 1774746000, 2) ,(1, 1792890000, 3) ,(1, 1806195600, 2) ,(1, 1824944400, 3) ,(1, 1837645200, 2) ,(1, 1856394000, 3) ,(1, 1869094800, 2) ,(1, 1887843600, 3) ,(1, 1901149200, 2) ,(1, 1919293200, 3) ,(1, 1932598800, 2) ,(1, 1950742800, 3) ,(1, 1964048400, 2) ,(1, 1982797200, 3) ,(1, 1995498000, 2) ,(1, 2014246800, 3) ,(1, 2026947600, 2) ,(1, 2045696400, 3) ,(1, 2058397200, 2) ,(1, 2077146000, 3) ,(1, 2090451600, 2) ,(1, 2108595600, 3) ,(1, 2121901200, 2) ,(1, 2140045200, 3) ,(3, -1688265000, 2) ,(3, -1656819048, 1) ,(3, -1641353448, 2) ,(3, -1627965048, 3) ,(3, -1618716648, 1) ,(3, -1596429048, 3) ,(3, -1593829848, 5) ,(3, -1589860800, 4) ,(3, -1542427200, 5) ,(3, -1539493200, 6) ,(3, -1525323600, 5) ,(3, -1522728000, 4) ,(3, -1491188400, 7) ,(3, -1247536800, 4) ,(3, 354920400, 5) ,(3, 370728000, 4) ,(3, 386456400, 5) ,(3, 402264000, 4) ,(3, 417992400, 5) ,(3, 433800000, 4) ,(3, 449614800, 5) ,(3, 465346800, 8) ,(3, 481071600, 9) ,(3, 496796400, 8) ,(3, 512521200, 9) ,(3, 528246000, 8) ,(3, 543970800, 9) ,(3, 559695600, 8) ,(3, 575420400, 9) ,(3, 591145200, 8) ,(3, 606870000, 9) ,(3, 622594800, 8) ,(3, 638319600, 9) ,(3, 654649200, 8) ,(3, 670374000, 10) ,(3, 686102400, 11) ,(3, 695779200, 8) ,(3, 701812800, 5) ,(3, 717534000, 4) ,(3, 733273200, 9) ,(3, 748998000, 8) ,(3, 764722800, 9) ,(3, 780447600, 8) ,(3, 796172400, 9) ,(3, 811897200, 8) ,(3, 828226800, 9) ,(3, 846370800, 8) ,(3, 859676400, 9) ,(3, 877820400, 8) ,(3, 891126000, 9) ,(3, 909270000, 8) ,(3, 922575600, 9) ,(3, 941324400, 8) ,(3, 954025200, 9) ,(3, 972774000, 8) ,(3, 985474800, 9) ,(3, 1004223600, 8) ,(3, 1017529200, 9) ,(3, 1035673200, 8) ,(3, 1048978800, 9) ,(3, 1067122800, 8) ,(3, 1080428400, 9) ,(3, 1099177200, 8) ,(3, 1111878000, 9) ,(3, 1130626800, 8) ,(3, 1143327600, 9) ,(3, 1162076400, 8) ,(3, 1174777200, 9) ,(3, 1193526000, 8) ,(3, 1206831600, 9) ,(3, 1224975600, 8) ,(3, 1238281200, 9) ,(3, 1256425200, 8) ,(3, 1269730800, 9) ,(3, 1288479600, 8) ,(3, 1301180400, 9) ,(3, 1319929200, 8) ,(3, 1332630000, 9) ,(3, 1351378800, 8) ,(3, 1364684400, 9) ,(3, 1382828400, 8) ,(3, 1396134000, 9) ,(3, 1414278000, 8) ,(3, 1427583600, 9) ,(3, 1445727600, 8) ,(3, 1459033200, 9) ,(3, 1477782000, 8) ,(3, 1490482800, 9) ,(3, 1509231600, 8) ,(3, 1521932400, 9) ,(3, 1540681200, 8) ,(3, 1553986800, 9) ,(3, 1572130800, 8) ,(3, 1585436400, 9) ,(3, 1603580400, 8) ,(3, 1616886000, 9) ,(3, 1635634800, 8) ,(3, 1648335600, 9) ,(3, 1667084400, 8) ,(3, 1679785200, 9) ,(3, 1698534000, 8) ,(3, 1711839600, 9) ,(3, 1729983600, 8) ,(3, 1743289200, 9) ,(3, 1761433200, 8) ,(3, 1774738800, 9) ,(3, 1792882800, 8) ,(3, 1806188400, 9) ,(3, 1824937200, 8) ,(3, 1837638000, 9) ,(3, 1856386800, 8) ,(3, 1869087600, 9) ,(3, 1887836400, 8) ,(3, 1901142000, 9) ,(3, 1919286000, 8) ,(3, 1932591600, 9) ,(3, 1950735600, 8) ,(3, 1964041200, 9) ,(3, 1982790000, 8) ,(3, 1995490800, 9) ,(3, 2014239600, 8) ,(3, 2026940400, 9) ,(3, 2045689200, 8) ,(3, 2058390000, 9) ,(3, 2077138800, 8) ,(3, 2090444400, 9) ,(3, 2108588400, 8) ,(3, 2121894000, 9) ,(3, 2140038000, 8) ,(4, -1688265000, 2) ,(4, -1656819048, 1) ,(4, -1641353448, 2) ,(4, -1627965048, 3) ,(4, -1618716648, 1) ,(4, -1596429048, 3) ,(4, -1593829848, 5) ,(4, -1589860800, 4) ,(4, -1542427200, 5) ,(4, -1539493200, 6) ,(4, -1525323600, 5) ,(4, -1522728000, 4) ,(4, -1491188400, 7) ,(4, -1247536800, 4) ,(4, 354920409, 5) ,(4, 370728010, 4) ,(4, 386456410, 5) ,(4, 402264011, 4) ,(4, 417992411, 5) ,(4, 433800012, 4) ,(4, 449614812, 5) ,(4, 465346812, 8) ,(4, 481071612, 9) ,(4, 496796413, 8) ,(4, 512521213, 9) ,(4, 528246013, 8) ,(4, 543970813, 9) ,(4, 559695613, 8) ,(4, 575420414, 9) ,(4, 591145214, 8) ,(4, 606870014, 9) ,(4, 622594814, 8) ,(4, 638319615, 9) ,(4, 654649215, 8) ,(4, 670374016, 10) ,(4, 686102416, 11) ,(4, 695779216, 8) ,(4, 701812816, 5) ,(4, 717534017, 4) ,(4, 733273217, 9) ,(4, 748998018, 8) ,(4, 764722818, 9) ,(4, 780447619, 8) ,(4, 796172419, 9) ,(4, 811897219, 8) ,(4, 828226820, 9) ,(4, 846370820, 8) ,(4, 859676420, 9) ,(4, 877820421, 8) ,(4, 891126021, 9) ,(4, 909270021, 8) ,(4, 922575622, 9) ,(4, 941324422, 8) ,(4, 954025222, 9) ,(4, 972774022, 8) ,(4, 985474822, 9) ,(4, 1004223622, 8) ,(4, 1017529222, 9) ,(4, 1035673222, 8) ,(4, 1048978822, 9) ,(4, 1067122822, 8) ,(4, 1080428422, 9) ,(4, 1099177222, 8) ,(4, 1111878022, 9) ,(4, 1130626822, 8) ,(4, 1143327622, 9) ,(4, 1162076422, 8) ,(4, 1174777222, 9) ,(4, 1193526022, 8) ,(4, 1206831622, 9) ,(4, 1224975622, 8) ,(4, 1238281222, 9) ,(4, 1256425222, 8) ,(4, 1269730822, 9) ,(4, 1288479622, 8) ,(4, 1301180422, 9) ,(4, 1319929222, 8) ,(4, 1332630022, 9) ,(4, 1351378822, 8) ,(4, 1364684422, 9) ,(4, 1382828422, 8) ,(4, 1396134022, 9) ,(4, 1414278022, 8) ,(4, 1427583622, 9) ,(4, 1445727622, 8) ,(4, 1459033222, 9) ,(4, 1477782022, 8) ,(4, 1490482822, 9) ,(4, 1509231622, 8) ,(4, 1521932422, 9) ,(4, 1540681222, 8) ,(4, 1553986822, 9) ,(4, 1572130822, 8) ,(4, 1585436422, 9) ,(4, 1603580422, 8) ,(4, 1616886022, 9) ,(4, 1635634822, 8) ,(4, 1648335622, 9) ,(4, 1667084422, 8) ,(4, 1679785222, 9) ,(4, 1698534022, 8) ,(4, 1711839622, 9) ,(4, 1729983622, 8) ,(4, 1743289222, 9) ,(4, 1761433222, 8) ,(4, 1774738822, 9) ,(4, 1792882822, 8) ,(4, 1806188422, 9) ,(4, 1824937222, 8) ,(4, 1837638022, 9) ,(4, 1856386822, 8) ,(4, 1869087622, 9) ,(4, 1887836422, 8) ,(4, 1901142022, 9) ,(4, 1919286022, 8) ,(4, 1932591622, 9) ,(4, 1950735622, 8) ,(4, 1964041222, 9) ,(4, 1982790022, 8) ,(4, 1995490822, 9) ,(4, 2014239622, 8) ,(4, 2026940422, 9) ,(4, 2045689222, 8) ,(4, 2058390022, 9) ,(4, 2077138822, 8) ,(4, 2090444422, 9) ,(4, 2108588422, 8) ,(4, 2121894022, 9) ,(4, 2140038022, 8) ,(5, -1009875600, 1); 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/mysqlaccess.sh b/scripts/mysqlaccess.sh index 0a2f402f584..bab0dbf5b87 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -1,4 +1,5 @@ #!/usr/bin/perl + # Copyright (c) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc. # Use is subject to license terms. # diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index ad6584f0571..02316d218e7 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -17,6 +17,23 @@ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA +# 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 Library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA + use Getopt::Long; use POSIX qw(strftime getcwd); @@ -76,20 +93,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 +101,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 +757,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 +784,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 cae63343cfc..20e5e115687 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=*|--data=*) DATADIR="$val" ;; --pid-file=*) pid_file="$val" ;; + --plugin-dir=*) PLUGIN_DIR="$val" ;; --user=*) user="$val"; SET_USER=1 ;; --log-basename=*|--hostname=*|--loose-log-basename=*) pid_file="$val.pid"; @@ -176,11 +190,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 @@ -207,6 +223,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) # @@ -229,6 +370,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 @@ -241,6 +385,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@' @@ -269,6 +417,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" @@ -297,6 +468,9 @@ export MYSQL_HOME if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults" then print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults" +elif test -x `dirname $0`/my_print_defaults +then + print_defaults="`dirname $0`/my_print_defaults" elif test -x ./bin/my_print_defaults then print_defaults="./bin/my_print_defaults" @@ -562,10 +736,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 @@ -574,17 +748,55 @@ cmd="$cmd $args" test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" log_notice "Starting $MYSQLD daemon with databases from $DATADIR" + +# variable to track the current number of "fast" (a.k.a. subsecond) restarts +fast_restart=0 +# maximum number of restarts before trottling kicks in +max_fast_restarts=5 +# flag whether a usable sleep command exists +have_sleep=1 + while true do rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety + start_time=`date +%M%S` + eval_log_error "$cmd" + end_time=`date +%M%S` + if test ! -f "$pid_file" # This is removed if normal shutdown then break fi + + # sanity check if time reading is sane and there's sleep + if test $end_time -gt 0 -a $have_sleep -gt 0 + then + # throttle down the fast restarts + if test $end_time -eq $start_time + then + fast_restart=`expr $fast_restart + 1` + if test $fast_restart -ge $max_fast_restarts + then + log_notice "The server is respawning too fast. Sleeping for 1 second." + sleep 1 + sleep_state=$? + if test $sleep_state -gt 0 + then + log_notice "The server is respawning too fast and no working sleep command. Turning off trottling." + have_sleep=0 + fi + + fast_restart=0 + fi + else + fast_restart=0 + fi + fi + if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1 then # Test if one process was hanging. diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh index 3694526c944..0de4fe159f0 100644 --- a/scripts/mysqldumpslow.sh +++ b/scripts/mysqldumpslow.sh @@ -1,4 +1,5 @@ #!/usr/bin/perl + # Copyright (c) 2000-2002, 2005-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc. # Use is subject to license terms. # diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 5977a181c93..48aefbd8c49 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 |