729
729
To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
731
Sun Microsystems, Inc. provides a set of binary distributions of
732
MySQL. In addition to binaries provided in platform-specific
733
package formats, we offer binary distributions for a number of
734
platforms in the form of compressed tar files (.tar.gz files). For
735
Windows distributions, see Section 2.5, "Installing MySQL on
731
Oracle provides a set of binary distributions of MySQL. In
732
addition to binaries provided in platform-specific package
733
formats, we offer binary distributions for a number of platforms
734
in the form of compressed tar files (.tar.gz files). For Windows
735
distributions, see Section 2.5, "Installing MySQL on Windows."
738
737
If you want to compile a debug version of MySQL from a source
739
738
distribution, you should add --with-debug or --with-debug=full to
760
759
version of tar that is known to have problems. For example,
761
760
the tar provided with early versions of Mac OS X, SunOS 4.x,
762
761
Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
763
are known to have problems with long file names. On Mac OS X,
764
you can use the preinstalled gnutar program. On Solaris 10 and
765
OpenSolaris you can use the preinstalled gtar. On other
766
systems with a deficient tar, you should install GNU tar
762
are known to have problems with long file names.
764
+ On Mac OS X, you can use the preinstalled gnutar program.
766
+ On Solaris 10 and OpenSolaris you can use the
769
+ On other systems with a deficient tar, you should install
774
If you have previously installed a MySQL installation using your
775
operating system native package management system, such as yum or
776
apt-get, you may experience problems installing using a native
777
binary. Make sure your previous MySQL previous installation has
778
been removed entirely (using your package management system), and
779
that any additional files, such as old versions of your data
780
files, have also been removed. You should also check the existence
781
of configuration files such as /etc/my.cnf or the /etc/mysql
782
directory have been deleted.
769
784
If you run into problems and need to file a bug report, please use
770
785
the instructions in Section 1.7, "How to Report Bugs or Problems."
772
787
The basic commands that you must execute to install and use a
773
788
MySQL binary distribution are:
792
The following process assumes that you have root (administrator)
793
access to your system. Alternatively you can prefix each command
794
using the sudo (Linux) or pfexec (OpenSolaris) command.
774
795
shell> groupadd mysql
775
796
shell> useradd -g mysql mysql
776
797
shell> cd /usr/local
793
814
A more detailed version of the preceding description for
794
815
installing a binary distribution follows:
796
1. Add a login user and group for mysqld to run as:
819
The following process assumes that you have root (administrator)
820
access to your system. Alternatively you can prefix each command
821
using the sudo (Linux) or pfexec (OpenSolaris) command.
823
1. If your system does not already have a user and group for
824
mysqld to run as, you may need to create one.
797
825
shell> groupadd mysql
798
826
shell> useradd -g mysql mysql
829
The above will create a user that has login permissions to
830
your server. You may wish to disable the account, as the user
831
is only required for ownership, not login, purposes.
799
832
These commands add the mysql group and the mysql user. The
800
833
syntax for useradd and groupadd may differ slightly on
801
834
different versions of Unix, or they may have different names
2113
2146
new mysqld then does something unexpected, you can simply shut it
2114
2147
down and restart with your old mysqld.
2116
If, after an upgrade, you experience problems with recompiled
2117
client programs, such as Commands out of sync or unexpected core
2118
dumps, you probably have used old header or library files when
2119
compiling your programs. In this case, you should check the date
2120
for your mysql.h file and libmysqlclient.a library to verify that
2121
they are from the new MySQL distribution. If not, recompile your
2122
programs with the new headers and libraries.
2149
If, after an upgrade, you experience problems with compiled client
2150
programs, such as Commands out of sync or unexpected core dumps,
2151
you probably have used old header or library files when compiling
2152
your programs. In this case, you should check the date for your
2153
mysql.h file and libmysqlclient.a library to verify that they are
2154
from the new MySQL distribution. If not, recompile your programs
2155
with the new headers and libraries. Recompilation might also be
2156
necessary for programs compiled against the shared client library
2157
if the library major version number has changed (for example from
2158
libmysqlclient.so.15 to libmysqlclient.so.16.
2124
2160
If problems occur, such as that the new mysqld server does not
2125
2161
start or that you cannot connect without a password, verify that
3640
3676
A tree view on the left side of the custom install dialog lists
3641
3677
all available components. Components that are not installed have a
3642
3678
red X icon; components that are installed have a gray icon. To
3643
change whether a component is installed, click on that component's
3679
change whether a component is installed, click that component's
3644
3680
icon and choose a new option from the drop-down list that appears.
3646
3682
You can change the default installation path by clicking the
3848
3884
must use the Add/Remove Programs tool within Control Panel. To do
3851
1. Right click on the start menu and choose Control Panel.
3887
1. Right-click the start menu and choose Control Panel.
3853
3889
2. If the Control Panel is set to category mode (you will see
3854
3890
Pick a category at the top of the Control Panel window),
3855
double click on Add or Remove Programs. If the Control is set
3856
to classic mode, doubgle click on the Add or Remove Programs
3891
double-click Add or Remove Programs. If the Control is set to
3892
classic mode, double-click the Add or Remove Programs icon.
3859
3894
3. Find MySQL in the list of installed software. MySQL Server is
3860
3895
installed against major version numbers (MySQL 5.0, MySQL 5.1,
3870
3905
logs produced during execution are kept in their configured
3908
If you try to install MySQL again the information will be retained
3909
and you will be prompted to enter the password configured with the
3910
original installation.
3912
If you want to delete MySQL completely, delete the associated data
3913
directory. On Windows XP and Windows Server 2003, before MySQL
3914
5.1.24, the default data directory would be located within the
3915
MySQL installation directory. On MySQL 5.1.24 and later, the
3916
default data directory is the configured AppData directory, which
3917
is C:\Documents and Settings\All Users\Application Data\MySQL by
3918
default. On Windows 7 and Windows Server 2008, the default data
3919
directory location is C:\ProgramData\Mysql.
3873
3921
2.5.4. MySQL Server Instance Config Wizard
3875
3923
The MySQL Server Instance Config Wizard helps automate the process
4242
4290
requires by default that you do so. If you do not wish to set
4243
4291
a root password, uncheck the box next to the Modify Security
4244
4292
Settings option.
4295
If you have previously installed MySQL, but not deleted the
4296
data directory associated with the previous installation, you
4297
may be prompted to provide the current root password. The
4298
password will be the one configured with your old data
4299
directory. If you do not want to use this data, or do not know
4300
the root password, you should cancel the installation, delete
4301
the previous installation data, and then restart the
4302
installation process. For more information on deleting MySQL
4303
data on Microsoft Windows, see Section 2.5.3.3, "Removing
4304
MySQL Installed from the MSI Package."
4245
4305
MySQL Server Instance Config Wizard: Security
4247
4307
* To set the root password, enter the desired password into both
4811
4871
name of the MySQL bin directory to your Windows system PATH
4812
4872
environment variable:
4814
* On the Windows desktop, right-click on the My Computer icon,
4815
and select Properties.
4874
* On the Windows desktop, right-click the My Computer icon, and
4817
4877
* Next select the Advanced tab from the System Properties menu
4818
4878
that appears, and click the Environment Variables button.
5148
5208
2.5.8. Windows Post-Installation Procedures
5150
On Windows, the data directory and the grant tables do not have to
5151
be created. MySQL Windows distributions include the grant tables
5152
with a set of preinitialized accounts in the mysql database under
5153
the data directory. It is unnecessary to run the mysql_install_db
5210
On Windows, you need not create the data directory and the grant
5211
tables. MySQL Windows distributions include the grant tables with
5212
a set of preinitialized accounts in the mysql database under the
5213
data directory. It is unnecessary to run the mysql_install_db
5154
5214
script that is used on Unix. Regarding passwords, if you installed
5155
5215
MySQL using the Windows Installation Wizard, you may have already
5156
5216
assigned passwords to the accounts. (See Section 2.5.3.1, "Using
5163
5223
and that it is operating properly. Make sure that the server is
5164
5224
running (see Section 2.5.5.4, "Starting the Server for the First
5165
5225
Time"), and then issue the following commands to verify that you
5166
can retrieve information from the server. The output should be
5167
similar to what is shown here:
5226
can retrieve information from the server. You may need to specify
5227
directory different from C:\mysql\bin on the command line. If you
5228
used the Windows Installation Wizard, the default directory is
5229
C:\Program Files\MySQL\MySQL Server 5.1, and the mysql and
5230
mysqlshow client programs are in C:\Program Files\MySQL\MySQL
5231
Server 5.1\bin. See Section 2.5.3.1, "Using the MySQL Installation
5232
Wizard," for more information.
5234
Use mysqlshow to see what databases exist:
5168
5235
C:\> C:\mysql\bin\mysqlshow
5169
5236
+--------------------+
5175
5242
+--------------------+
5179
The above may not work if the correct user does not exist. If you
5180
installed using the MSI packages and used the MySQL Server
5181
Instance Config Wizard, then the root will haqve been created
5182
automatically with the password you supplied. In this case, you
5183
should use the -u and -p options where you will be prompted for
5188
5244
The list of installed databases may vary, but will always include
5189
5245
the minimum of mysql and information_schema. In most cases, the
5190
5246
test database will also be installed automatically.
5192
If you specify the name of the database, then a list of the tables
5193
within a given database will be displayed:
5248
The preceding command (and commands for other MySQL programs such
5249
as mysql) may not work if the correct MySQL account does not
5250
exist. For example, the program may fail with an error, or you may
5251
not be able to view all databases. If you installed using the MSI
5252
packages and used the MySQL Server Instance Config Wizard, then
5253
the root user will have been created automatically with the
5254
password you supplied. In this case, you should use the -u root
5255
and -p options. (You will also need to use the -u root and -p
5256
options if you have already secured the initial MySQL accounts.)
5257
With -p, you will be prompted for the root password. For example:
5258
C:\> C:\mysql\bin\mysqlshow -u root -p
5259
Enter password: (enter root password here)
5260
+--------------------+
5262
+--------------------+
5263
| information_schema |
5266
+--------------------+
5268
If you specify a database name, mysqlshow displays a list of the
5269
tables within the database:
5194
5270
C:\> C:\mysql\bin\mysqlshow mysql
5195
5271
Database: mysql
5196
5272
+---------------------------+
5216
| time_zone_leap_second |
5218
| time_zone_transition |
5219
| time_zone_transition_type |
5221
+---------------------------+
5224
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
5225
+------+-------+------+
5226
| host | db | user |
5227
+------+-------+------+
5229
+------+-------+------+
5231
You may need to specify a different directory from the one shown;
5232
if you used the Windows Installation Wizard, then the default
5233
directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
5234
mysql and mysqlshow client programs are in C:\Program
5235
Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the
5236
MySQL Installation Wizard," for more information.
5238
If you have already secured the initial MySQL accounts, you may
5239
need to use the -u and -p options to supply a user name and
5240
password to the mysqlshow and mysql client programs; otherwise the
5241
programs may fail with an error, or you may not be able to view
5242
all databases. For example, if you have assigned the password
5243
"secretpass" to the MySQL root account, then you can invoke
5244
mysqlshow and mysql as shown here:
5245
C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
5246
+--------------------+
5248
+--------------------+
5249
| information_schema |
5252
+--------------------+
5254
C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
5256
+---------------------------+
5258
+---------------------------+
5276
| time_zone_leap_second |
5278
| time_zone_transition |
5279
| time_zone_transition_type |
5281
+---------------------------+
5284
C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
5286
+------+-------+------+
5287
| host | db | user |
5288
+------+-------+------+
5290
+------+-------+------+
5292
For more information about these programs, see Section 4.5.6,
5290
| time_zone_leap_second |
5292
| time_zone_transition |
5293
| time_zone_transition_type |
5295
+---------------------------+
5297
Use the mysql program to select information from a table in the
5299
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM mysql.db"
5300
+------+--------+------+
5301
| host | db | user |
5302
+------+--------+------+
5305
+------+--------+------+
5307
For more information about mysqlshow and mysql, see Section 4.5.6,
5293
5308
"mysqlshow --- Display Database, Table, and Column Information,"
5294
5309
and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
5296
If you are running a version of Windows that supports services and
5297
you want the MySQL server to run automatically when Windows
5298
starts, see Section 2.5.5.6, "Starting MySQL as a Windows
5311
If you are running a version of Windows that supports services,
5312
you can set up the MySQL server to run automatically when Windows
5313
starts. See Section 2.5.5.6, "Starting MySQL as a Windows
5301
5316
2.5.9. MySQL on Windows Compared to MySQL on Unix
5574
5589
+ WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
5575
5590
storage engine.
5577
+ WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
5578
NDBCLUSTER storage engine in the MySQL server; cause
5579
binaries for the MySQL Cluster management and data node,
5580
management client, and other programs to be built.
5592
+ WITH_NDBCLUSTER_STORAGE_ENGINE: Enable the NDBCLUSTER
5593
storage engine in the MySQL server; cause binaries for
5594
the MySQL Cluster management and data node, management
5595
client, and other programs to be built.
5581
5596
This option is supported only in MySQL Cluster NDB 7.0
5582
5597
(NDBCLUSTER storage engine versions 6.4.0 and later)
5583
5598
using the MySQL Cluster sources. It cannot be used to
5786
5801
all installed RPMs, including the Server and Client RPMs.
5788
5803
For more information about installing MySQL Cluster from RPMs, see
5789
Section 17.2.1, "MySQL Cluster Multi-Computer Installation."
5804
Section 17.2.1.1, "MySQL Cluster Multi-Computer Installation."
5791
5806
For upgrades, if your installation was originally produced by
5792
5807
installing multiple RPM packages, it is best to upgrade all the
5933
5948
new directory layout that uses /etc/init.d, because it is required
5934
5949
for LSB (Linux Standard Base) compliance.
5951
In MySQL 5.1.49 and later, during an upgrade installation using
5952
the RPM packages, if the MySQL server is running when the upgrade
5953
occurs, the MySQL server is stopped, the upgrade occurs, and the
5954
MySQL server is restarted. If the MySQL server is not already
5955
running when the RPM upgrade occurs, the MySQL server is not
5956
started at the end of the installation.
5936
5958
If the RPM files that you install include MySQL-server, the mysqld
5937
5959
server should be up and running after installation. You should be
5938
5960
able to start using MySQL.
5955
5977
users and groups (as listed in the /etc/passwd and /etc/group
5956
5978
files) by the RPM installation process being run by root.
5980
If you log in as the mysql user, you may find that MySQL displays
5981
"Invalid (old?) table or database name" errors that mention
5982
.mysqlgui, lost+found, .mysqlgui, .bash_history, .fonts.cache-1,
5983
.lesshst, .mysql_history, .profile, .viminfo, and similar files
5984
created by MySQL or operating system utilities. You can safely
5985
ignore these error messages or remove the files or directories
5986
that cause them if you do not need them.
5958
5988
For nonlocal user management (LDAP, NIS, and so forth), the
5959
5989
administrative tools may require additional authentication (such
5960
5990
as a password), and will fail if the installing user does not
6063
6093
MySQLStartupItem.pkg installation package, and the
6064
6094
MySQL.prefPane.
6066
2. Double-click on the MySQL installer package. It will be named
6096
2. Double-click the MySQL installer package. It will be named
6067
6097
according to the version of MySQL you have downloaded. For
6068
6098
example, if you have downloaded MySQL 5.1.39, double-click
6069
6099
mysql-5.1.39-osx10.5-x86.pkg.
6071
3. You will be presented with the openin installer dialog. Click
6072
Continue to begihn installation.
6101
3. You will be presented with the opening installer dialog. Click
6102
Continue to begin installation.
6073
6103
MySQL Package Installer: Step 1
6075
6105
4. A copy of the installation instructions and other important
6076
information relevant to this installation are display. Click
6106
information relevant to this installation are displayed. Click
6079
6109
5. If you have downloaded the community version of MySQL, you
6092
6122
startup item, click Install.
6094
6124
8. Once the installation has been completed successfully, you
6095
will be given an Install Succeeded message.
6125
will be shown an Install Succeeded message.
6097
6127
Once you have completed the basic installation, you must complete
6098
6128
the post-installation steps as specifed in Section 2.13,
6138
6168
install the startup item, click Install.
6140
6170
7. Once the installation has been completed successfully, you
6141
will be given an Install Succeeded message.
6171
will be shown an Install Succeeded message.
6142
6172
MySQL Startup Item Installer: Step 5
6144
6174
The Startup Item for MySQL is installed into
6145
6175
/Library/StartupItems/MySQLCOM. The Startup Item installation adds
6146
6176
a variable MYSQLCOM=-YES- to the system configuration file
6147
6177
/etc/hostconfig. If you want to disable the automatic startup of
6148
MySQL, simply change this variable to MYSQLCOM=-NO-.
6178
MySQL, change this variable to MYSQLCOM=-NO-.
6150
6180
After the installation, you can start up MySQL by running the
6151
6181
following commands in a terminal window. You must have
6201
6231
Once the MySQL Preference Pane has been installed, you can control
6202
6232
your MySQL server instance using the preference pane. To use the
6203
6233
preference pane, open the System Preferences... from the Apple
6204
menu. Select the MySQL preference pane by clicking on the MySQL
6205
logo within the Other section of the preference panes list.
6234
menu. Select the MySQL preference pane by clicking the MySQL logo
6235
within the Other section of the preference panes list.
6206
6236
MySQL Preference Pane
6208
6238
The MySQL Preference Pane shows the current status of the MySQL
6309
6339
* Due to a bug in the Mac OS X package installer, you may see
6310
6340
this error message in the destination disk selection dialog:
6311
6341
You cannot install this software on this disk. (null)
6312
If this error occurs, simply click the Go Back button once to
6313
return to the previous screen. Then click Continue to advance
6314
to the destination disk selection again, and you should be
6315
able to choose the destination disk correctly. We have
6316
reported this bug to Apple and it is investigating this
6342
If this error occurs, click the Go Back button once to return
6343
to the previous screen. Then click Continue to advance to the
6344
destination disk selection again, and you should be able to
6345
choose the destination disk correctly. We have reported this
6346
bug to Apple and it is investigating this problem.
6319
6348
* Because the MySQL package installer installs the MySQL
6320
6349
contents into a version and platform specific directory, you
7306
7339
./tests/auto_increment.res file.
7308
7341
9. At this point, you should have the server running. However,
7309
none of the initial MySQL accounts have a password, so you
7310
should assign passwords using the instructions found in
7311
Section 2.13.2, "Securing the Initial MySQL Accounts."
7342
none of the initial MySQL accounts have a password, and the
7343
server allows permissive access to test databases. To tighten
7344
security, follow the instructions in Section 2.13.2, "Securing
7345
the Initial MySQL Accounts."
7313
7347
The MySQL 5.1 installation procedure creates time zone tables in
7314
7348
the mysql database. However, you must populate the tables manually
7841
7875
accounts access to the test database and other databases with
7842
7876
names that start with test_. This is true even for accounts that
7843
7877
otherwise have no special privileges such as the default anonymous
7844
accounts. This is convenient for testing, but administrators may
7845
want database access restricted only to accounts that have
7846
permissions granted explicitly for that purpose, particularly on
7847
production servers. Such administrators should remove these
7848
mysql.db table rows.
7878
accounts. This is convenient for testing but inadvisable on
7879
production servers. Administrators who want database access
7880
restricted only to accounts that have permissions granted
7881
explicitly for that purpose should remove these mysql.db table
7850
7884
The following instructions describe how to set up passwords for
7851
7885
the initial MySQL accounts, first for for the root accounts, then