Rechercher dans le manuel MySQL
2.9.4 Installing MySQL Using a Standard Source Distribution
To install MySQL from a standard source distribution:
Verify that your system satisfies the tool requirements listed at Section 2.9.2, “Source Installation Prerequisites”.
Obtain a distribution file using the instructions in Section 2.1.2, “How to Get MySQL”.
Configure, build, and install the distribution using the instructions in this section.
Perform postinstallation procedures using the instructions in Section 2.10, “Postinstallation Setup and Testing”.
MySQL uses CMake as the build framework on all platforms. The instructions given here should enable you to produce a working installation. For additional information on using CMake to build MySQL, see How to Build MySQL Server with CMake.
If you start from a source RPM, use the following command to make a binary RPM that you can install. If you do not have rpmbuild, use rpm instead.
shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
The result is one or more binary RPM packages that you install as indicated in Section 2.5.4, “Installing MySQL on Linux Using RPM Packages from Oracle”.
The sequence for installation from a compressed tar file or Zip archive source distribution is similar to the process for installing from a generic binary distribution (see Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”), except that it is used on all platforms and includes steps to configure and compile the distribution. For example, with a compressed tar file source distribution on Unix, the basic installation command sequence looks like this:
# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> mkdir bld
shell> cd bld
shell> cmake ..
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
A more detailed version of the source-build specific instructions is shown following.
The procedure shown here does not set up any passwords for MySQL accounts. After following the procedure, proceed to Section 2.10, “Postinstallation Setup and Testing”, for postinstallation setup and testing.
Perform Preconfiguration Setup
On Unix, set up the mysql
user and group that
will be used to run and execute the MySQL server and own the
database directory. For details, see
Create a mysql User and Group. Then
perform the following steps as the mysql
user, except as noted.
Pick the directory under which you want to unpack the distribution and change location into it.
Obtain a distribution file using the instructions in Section 2.1.2, “How to Get MySQL”.
Unpack the distribution into the current directory:
To unpack a compressed tar file, tar can uncompress and unpack the distribution if it has
z
option support:shell> tar zxvf mysql-VERSION.tar.gz
If your tar does not have
z
option support, use gunzip to unpack the distribution and tar to unpack it:shell> gunzip < mysql-VERSION.tar.gz | tar xvf -
Alternatively, CMake can uncompress and unpack the distribution:
shell> cmake -E tar zxvf mysql-VERSION.tar.gz
To unpack a Zip archive, use WinZip or another tool that can read
.zip
files.
Unpacking the distribution file creates a directory named
mysql-
.
VERSION
Change location into the top-level directory of the unpacked distribution:
shell> cd mysql-VERSION
Build outside of the source tree to keep the tree clean. If the
top-level source directory is named
mysql-src
under your current working
directory, you can build in a directory named
bld
at the same level. Create the directory
and go there:
shell> mkdir bld
shell> cd bld
Configure the build directory. The minimum configuration command includes no options to override configuration defaults:
shell> cmake ../mysql-src
The build directory needs not be outside the source tree.
For example, you can build in a directory named
bld
under the top-level source tree. To do
this, starting with mysql-src
as your
current working directory, create the directory
bld
and then go there:
shell> mkdir bld
shell> cd bld
Configure the build directory. The minimum configuration command includes no options to override configuration defaults:
shell> cmake ..
If you have multiple source trees at the same level (for example, to build multiple versions of MySQL), the second strategy can be advantageous. The first strategy places all build directories at the same level, which requires that you choose a unique name for each. With the second strategy, you can use the same name for the build directory within each source tree. The following instructions assume this second strategy.
On Windows, specify the development environment. For example, the following commands configure MySQL for 32-bit or 64-bit builds, respectively:
shell> cmake .. -G "Visual Studio 12 2013"
shell> cmake .. -G "Visual Studio 12 2013 Win64"
On macOS, to use the Xcode IDE:
shell> cmake .. -G Xcode
When you run cmake, you might want to add options to the command line. Here are some examples:
-DBUILD_CONFIG=mysql_release
: Configure the source with the same build options used by Oracle to produce binary distributions for official MySQL releases.-DCMAKE_INSTALL_PREFIX=
: Configure the distribution for installation under a particular location.dir_name
-DCPACK_MONOLITHIC_INSTALL=1
: Cause make package to generate a single installation file rather than multiple files.-DWITH_DEBUG=1
: Build the distribution with debugging support.
For a more extensive list of options, see Section 2.9.7, “MySQL Source-Configuration Options”.
To list the configuration options, use one of the following commands:
shell> cmake .. -L # overview
shell> cmake .. -LH # overview with help text
shell> cmake .. -LAH # all params with help text
shell> ccmake .. # interactive display
If CMake fails, you might need to reconfigure by running it again with different options. If you do reconfigure, take note of the following:
If CMake is run after it has previously been run, it may use information that was gathered during its previous invocation. This information is stored in
CMakeCache.txt
. When CMake starts, it looks for that file and reads its contents if it exists, on the assumption that the information is still correct. That assumption is invalid when you reconfigure.Each time you run CMake, you must run make again to recompile. However, you may want to remove old object files from previous builds first because they were compiled using different configuration options.
To prevent old object files or configuration information from being used, run these commands in the build direcotry on Unix before re-running CMake:
shell> make clean
shell> rm CMakeCache.txt
Or, on Windows:
shell> devenv MySQL.sln /clean
shell> del CMakeCache.txt
Before asking on the
MySQL Community
Slack, check the files in the
CMakeFiles
directory for useful information
about the failure. To file a bug report, please use the
instructions in Section 1.7, “How to Report Bugs or Problems”.
On Unix:
shell> make
shell> make VERBOSE=1
The second command sets VERBOSE
to show the
commands for each compiled source.
Use gmake instead on systems where you are using GNU make and it has been installed as gmake.
On Windows:
shell> devenv MySQL.sln /build RelWithDebInfo
If you have gotten to the compilation stage, but the
distribution does not build, see
Section 2.9.8, “Dealing with Problems Compiling MySQL”, for help. If that does
not solve the problem, please enter it into our bugs database
using the instructions given in Section 1.7, “How to Report Bugs or Problems”.
If you have installed the latest versions of the required tools,
and they crash trying to process our configuration files, please
report that also. However, if you get a command not
found
error or a similar problem for required tools,
do not report it. Instead, make sure that all the required tools
are installed and that your PATH
variable is
set correctly so that your shell can find them.
On Unix:
shell> make install
This installs the files under the configured installation
directory (by default, /usr/local/mysql
).
You might need to run the command as root
.
To install in a specific directory, add a
DESTDIR
parameter to the command line:
shell> make install DESTDIR="/opt/mysql"
Alternatively, generate installation package files that you can install where you like:
shell> make package
This operation produces one or more .tar.gz
files that can be installed like generic binary distribution
packages. See Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”. If you run
CMake with
-DCPACK_MONOLITHIC_INSTALL=1
, the
operation produces a single file. Otherwise, it produces
multiple files.
On Windows, generate the data directory, then create a
.zip
archive installation package:
shell> devenv MySQL.sln /build RelWithDebInfo /project initial_database
shell> devenv MySQL.sln /build RelWithDebInfo /project package
You can install the resulting .zip
archive
where you like. See Section 2.3.4, “Installing MySQL on Microsoft Windows Using a
noinstall
ZIP Archive”.
The remainder of the installation process involves setting up the configuration file, creating the core databases, and starting the MySQL server. For instructions, see Section 2.10, “Postinstallation Setup and Testing”.
The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.10, “Postinstallation Setup and Testing”.
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-installing-source-distribution.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.