The recommended way to install MySQL on RPM-based Linux
distributions is by using the RPM packages. The RPMs that we
provide to the community should work on all versions of Linux that
support RPM packages and use glibc
2.3. To
obtain RPM packages, see Section 2.1.3, “How to Get MySQL”.
For non-RPM Linux distributions, you can install MySQL using a
.tar.gz
package. See
Section 2.9, “Installing MySQL from tar.gz
Packages on Other
Unix-Like Systems”.
We do provide some platform-specific RPMs; the difference between a platform-specific RPM and a generic RPM is that a platform-specific RPM is built on the targeted platform and is linked dynamically whereas a generic RPM is linked statically with LinuxThreads.
RPM distributions of MySQL often are provided by other vendors. Be aware that they may differ in features and capabilities from those built by us, and that the instructions in this manual do not necessarily apply to installing them. The vendor's instructions should be consulted instead.
If you have problems with an RPM file (for example, if you receive
the error Sorry, the host
'
), see Section 2.13.1.2, “Linux Binary Distribution Notes”.
xxxx
' could not be looked
up
In most cases, you need to install only the
MySQL-server
and
MySQL-client
packages to get a functional MySQL
installation. The other packages are not required for a standard
installation.
RPMs for MySQL Cluster.
Standard MySQL server RPMs built by MySQL do not provide support
for the NDBCLUSTER
storage engine.
When upgrading a MySQL Cluster RPM installation, you must
upgrade all installed RPMs, including
the Server
and Client
RPMs.
For more information about installing MySQL Cluster from RPMs, see MySQL Cluster Multi-Computer Installation.
For upgrades, if your installation was originally produced by installing multiple RPM packages, it is best to upgrade all the packages, not just some. For example, if you previously installed the server and client RPMs, do not upgrade just the server RPM.
If you get a dependency failure when trying to install MySQL
packages (for example, error: removing these packages
would break dependencies: libmysqlclient.so.10 is needed by
...
), you should also install the
MySQL-shared-compat
package, which includes
both the shared libraries for backward compatibility
(libmysqlclient.so.12
for MySQL 4.0 and
libmysqlclient.so.10
for MySQL 3.23).
Some Linux distributions still ship with MySQL 3.23 and they
usually link applications dynamically to save disk space. If these
shared libraries are in a separate package (for example,
MySQL-shared
), it is sufficient to simply leave
this package installed and just upgrade the MySQL server and
client packages (which are statically linked and do not depend on
the shared libraries). For distributions that include the shared
libraries in the same package as the MySQL server (for example,
Red Hat Linux), you could either install our 3.23
MySQL-shared
RPM, or use the
MySQL-shared-compat
package instead. (Do not
install both.)
The RPM packages shown in the following list are available. The
names shown here use a suffix of
.glibc23.i386.rpm
, but particular packages
can have different suffixes, as described later.
MySQL-server-
VERSION
.glibc23.i386.rpm
The MySQL server. You need this unless you only want to connect to a MySQL server running on another machine.
MySQL-client-
VERSION
.glibc23.i386.rpm
The standard MySQL client programs. You probably always want to install this package.
MySQL-devel-
VERSION
.glibc23.i386.rpm
The libraries and include files that are needed if you want to compile other MySQL clients, such as the Perl modules.
MySQL-debuginfo-
VERSION
.glibc23.i386.rpm
This package contains debugging information.
debuginfo
RPMs are never needed to use
MySQL software; this is true both for the server and for
client programs. However, they contain additional information
that might be needed by a debugger to analyze a crash.
MySQL-shared-
VERSION
.glibc23.i386.rpm
This package contains the shared libraries
(libmysqlclient.so*
) that certain languages
and applications need to dynamically load and use MySQL. It
contains single-threaded and thread-safe libraries. If you
install this package, do not install the
MySQL-shared-compat
package.
MySQL-shared-compat-
VERSION
.glibc23.i386.rpm
This package includes the shared libraries for MySQL 3.23,
4.0, and so on, up to the current release. It contains
single-threaded and thread-safe libraries. Install this
package instead of MySQL-shared
if you have
applications installed that are dynamically linked against
older versions of MySQL but you want to upgrade to the current
version without breaking the library dependencies.
MySQL-embedded-
VERSION
.glibc23.i386.rpm
The embedded MySQL server library.
MySQL-ndb-management-
,
VERSION
.glibc23.i386.rpmMySQL-ndb-storage-
,
VERSION
.glibc23.i386.rpmMySQL-ndb-tools-
,
VERSION
.glibc23.i386.rpmMySQL-ndb-extra-
VERSION
.glibc23.i386.rpm
Packages that contain additional files for MySQL Cluster installations.
The MySQL-ndb-tools
RPM requires a
working installation of perl. See
Section 2.15, “Perl Installation Notes”, and
ndb_size.pl, for
more information.
MySQL-test-
VERSION
.glibc23.i386.rpm
This package includes the MySQL test suite.
MySQL-
VERSION
.src.rpm
This contains the source code for all of the previous packages. It can also be used to rebuild the RPMs on other architectures (for example, Alpha or SPARC).
The suffix of RPM package names (following the
VERSION
value) has the following
syntax:
.PLATFORM
.CPU
.rpm
The PLATFORM
and
CPU
values indicate the type of system
for which the package is built.
PLATFORM
indicates the platform and
CPU
indicates the processor type or
family.
All packages are dynamically linked against
glibc
2.3. The
PLATFORM
value indicates whether the
package is platform independent or intended for a specific
platform, as shown in the following table.
glibc23 |
Platform independent, should run on any Linux distribution that supports
glibc 2.3 |
rhel3 , rhel4
|
Red Hat Enterprise Linux 3 or 4 |
sles9 , sles10
|
SuSE Linux Enterprise Server 9 or 10 |
In MySQL 5.4, only glibc23
packages are available currently.
The CPU
value indicates the processor
type or family for which the package is built.
i386 |
x86 processor, 386 and up |
i586 |
x86 processor, Pentium and up |
x86_64 |
64-bit x86 processor |
ia64 |
Itanium (IA-64) processor |
To see all files in an RPM package (for example, a
MySQL-server
RPM), run a command like this:
shell> rpm -qpl MySQL-server-VERSION
.glibc23.i386.rpm
To perform a standard minimal installation, install the server and client RPMs:
shell>rpm -i MySQL-server-
shell>VERSION
.glibc23.i386.rpmrpm -i MySQL-client-
VERSION
.glibc23.i386.rpm
To install only the client programs, install just the client RPM:
shell> rpm -i MySQL-client-VERSION
.glibc23.i386.rpm
RPM provides a feature to verify the integrity and authenticity of
packages before installing them. If you would like to learn more
about this feature, see
Section 2.1.4, “Verifying Package Integrity Using MD5 Checksums or
GnuPG
”.
The server RPM places data under the
/var/lib/mysql
directory. The RPM also
creates a login account for a user named mysql
(if one does not exist) to use for running the MySQL server, and
creates the appropriate entries in
/etc/init.d/
to start the server
automatically at boot time. (This means that if you have performed
a previous installation and have made changes to its startup
script, you may want to make a copy of the script so that you
don't lose it when you install a newer RPM.) See
Section 2.11.2.2, “Starting and Stopping MySQL Automatically”, for more information on how
MySQL can be started automatically on system startup.
If you want to install the MySQL RPM on older Linux distributions
that do not support initialization scripts in
/etc/init.d
(directly or via a symlink), you
should create a symbolic link that points to the location where
your initialization scripts actually are installed. For example,
if that location is /etc/rc.d/init.d
, use
these commands before installing the RPM to create
/etc/init.d
as a symbolic link that points
there:
shell>cd /etc
shell>ln -s rc.d/init.d .
However, all current major Linux distributions should support the
new directory layout that uses /etc/init.d
,
because it is required for LSB (Linux Standard Base) compliance.
If the RPM files that you install include
MySQL-server
, the mysqld
server should be up and running after installation. You should be
able to start using MySQL.
If something goes wrong, you can find more information in the
binary installation section. See
Section 2.9, “Installing MySQL from tar.gz
Packages on Other
Unix-Like Systems”.
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.11, “Post-Installation Setup and Testing”.
During RPM installation, a user named mysql
and
a group named mysql
are created on the system.
This is done using the useradd,
groupadd, and usermod
commands. Those commands require appropriate administrative
privileges, which is ensured for locally managed users and groups
(as listed in the /etc/passwd
and
/etc/group
files) by the RPM installation
process being run by root
.
For nonlocal user management (LDAP, NIS, and so forth), the administrative tools may require additional authentication (such as a password), and will fail if the installing user does not provide this authentication. Even if they fail, the RPM installation will not abort but succeed, and this is intentional. If they failed, some of the intended transfer of ownership may be missing, and it is recommended that the system administrator then manually ensures some appropriate user andgroup exists and manually transfers ownership following the actions in the RPM spec file.
User Comments
I successfully installed MySQL 4.0.15 onto a Cobalt RaQ4i running Red Hat Cobalt Linux 6.0, even though Sun's Cobalt Support Desk says it won't install because of the glibc version available on this appliance. The standard installation (server and client only) is compatible with this particular web appliance.
I used RPM to install both server and client. Because I wanted to change the location of where the actual data would be stored, I tried configuring the my.cnf file and using symlinks. I found using the symlinks to be easier and more compatible.
My data directory is /home/mysql.
The following is what I did to change the data directory after using RPM to install.
1. stop mysql server
2. mkdir /home/mysql
3. mv /var/lib/mysql/* /home/mysql/
4. rmdir /var/lib/mysql
5. ln -s /home/mysql /var/lib/mysql
6. chown -R mysql:mysql /home/mysql
7. start mysql server again
Here is an explanation of where to edit the my.cnf file to change data file locations:
http://lists.mysql.com/mysql/128959
Instead of using symlinks,you can just modify the my.cnf file by including "datadir = /path/to/ur/dir/"
and copy all the data from existing data dir to the new data dir.
If your installing in a 2.6 kernel, either disable SELinux or set a new policy before trying to install MySQL-server. Without it the mysql_install_db and mysqld steps of the RPM will fail.
be very cautitous about the configuration s that u perform in the following files
/etc/my.cnf
/var/lib/mysql/mysql.sock
these are to be read first before moving on to the post installation steps procedure.
this will help in saving time later.
This simplest way to disable SELinux without reboot.
Q:
How do I temporarily turn off enforcing mode without having to reboot?
A:
This situation usually arises when you can't perform an action that is being prevented by policy. Run the command setenforce 0 to turn off enforcing mode in real time. When you are finished, run setenforce 1 to turn enforcing back on.
(my setenforce was in /usr/sbin)
Start Mysql........ERROR! Great help Mr. RPM.
I wanted to post my experience someone, because I uncovered nothing on the internet that was useful.
I was trying to install mysql server 4.1 RPM on Fedora2, and any instructions I found on this site just told me essentially to download and run the RPM.
Anyway, from what I can tell. The mysql 4.0 that was already running already was installed without RPM). So, after screwing around looking for non-existent help to uninstall mysql manually I eventually worked something out.
1.log in as root
2.look for processes run as root:
# ps ux
3.look in the PID (process id) COLUMN for the process with
the string "mysql_safe" in the COMMAND column
4.kill that process (replace PID with the process ID)
# kill -9 PID
5.log in as mysql (it is possible that mysql runs under another user - if so use "#ps axu" to find out which user.
6. get the *first* PID of the mysql process again using:
# ps ux
7. Kill the first process, should kill the rest but check afterwards:
# kill -9 PID
After that, try installing the rpm.
# rpm -i mysql...
Some tips:
-Don't type in the full file name after the -i (eg. .i386.rpm)
-If there is something about "V3 DSA signature: NOKEY" just ignore it because I a dozen threads in which that was present and no-one cared.
-If it complains of failed dependencies PERL(DBI) just ignore because that is apparently a very common package that will be there, just rpm is not "man"ager enough to find it.
Hope my ten minutes saves someone else 3 hours.
Now I'm going to find something else to screw up.
Thanks
sime
When installing 5.0.16-server on a FC4 machine (or possibly any other machine with selinux) you may notice:
- safe_mysqld starts perfectly with all the options from /etc/init.d/mysql
- /etc/init.d/mysql quietly fails to start mysql without any errors
Disabling selinux and restarting the server solves this startup problem. You can disable selinux in /etc/sysconfig/selinux on an FC4 server.
Installing 5.0.19 rpm on redhat 4 advanced server the mysql init script parsing messes up variables, for exemple mysqlmanager=/var/lib/bin/mysqlmanager
Fix: copy the mysqld script from the stock redhat 4 mysql rpm, rename to mysql and change the permissions on the script(+x) .
I found also that 4.1.16-server does not like to run normally on Fedora Core 4 because of the selinux. It appears my /etc/sysconfig/selinux was a symlink to /etc/selinux/config . After changing that file (the directions are in the file for disabling selinux) and rebooting, 5 and 4 both installed and started fine for me.
After installed the download RPM version of 5.0.21 server for RH4, pls modify the line in /etc/my.cnf from "basedir="/var/lib" to "basedir=/usr" in order for successful starting the mysql service
If you are doing an upgrade and you are having problems to start the MySQL server on RHEL, make sure you delete the file /etc/my.cnf
Correct installation steps for MySQL 5.0.24 on RedHat Enterprise Linux 4 with RPM:
Pre-reqs:
1. If you have /etc/my.cnf, delete it.
2. If you have /var/lib/mysql directory, remove it.
Then do:
1. /usr/sbin/setenforce 0
2. rpm -Uvh MySQL-server-standard-5.0.24-0.rhel4.i386.rpm MySQL-client-standard-5.0.24-0.rhel4.i386.rpm
3. /usr/sbin/setenforce 1
The server then starts okay once the rpm installation is complete.
Unfortunately, the basic rpm install didn't work for me. It just returned a slough of libmysql dependency errors. So eventually here is what I did to get it to work:
# setenforce 0
# rm -rf /usr/lib/libmysql*
# rpm -Uvh --force MySQL-server-standard-5.0.24-0.rhel4.i386.rpm MySQL-client-standard-5.0.24-0.rhel4.i386.rpm MySQL-shared-standard-5.0.24-0.rhel4.i386.rpm
# cp /usr/lib/libmysqlclient.15 /usr/lib/libmysqlclient.14
# cp /usr/lib/libmysqlclient.15.0.0 /usr/lib/libmysqlclient.14.0.0
# rm /var/lib/ib*
# chown -R mysql /var/lib/mysql
# setenforce 1
# service mysql start
Check /var/lib/mysql/{YOUR_SERVER}.err
It should report no errors (except recreating the ib* files) and state version 5.0.24 running.
NOTE: Rather than deleting the libmysql* files, you may prefer to move them somewhere safe. Also, it's possible that the libmysql* increment numbers will not match mine. The libmysqlclient I copied was the only one there (post install), and the copy I made was simply named to match an error that Apache was giving when I tried to restart.
Also, don't forget that you may need to re-compile PHP after this upgrade with the "--with-mysqli" option instead of "--with-mysql", or you will get an error saying "MySQL extension not loaded".
when installing on RHEL4 with selinux enabled is still had problems when i enbled selinux after installation. apparently there's still a problem with the way the mysql rpm installs on redhat. long version here: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=167551
Installing worked for me after relabeling the files in selinux with the restorecon commando.
step by step installation:
setenforce 0 #disbles selinux temporarily
rpm -ivh MySQL-server-standard-5.0.27-0.rhel4.i386.rpm
restorecon -R /var/lib/mysql/ #restore selinux labels
setenforce 1 #enable selinux again
test by stopping and starting mysql again after with selinux enabled
Mandriva Linux
The ln -s instructions do not provide a workable pointer in Mandriva for some reason I don't understand. I was able to work around this by using mv and moving/renameing the subdirectory of the unzipped archive to /usr/local/mysql instead of using a link to it.
ln -s mysql [etc] did create a link, as the instructions said, but the link did not act as the rest of the instructions indicated it should. By moving/renaming the problem went away.
1- # rpm -ivh MySQL-* --aid --force: To install both Mysql-server and Mysql-client
2- Copy the configuration file to /etc/my.cnf
# cd /usr/share/doc/packages/MySQL-server-community
# cp my-small.cnf /etc/my.cnf
3- If you want to change the default port "3306" for mysql:
# vi /etc/my.cnf :
:set number
go to line 20 and change mysql default port, then
:wq;
# chkconfig --level 35 mysql on
# service mysql restart
. To Give the prmission to waseele user to loging remotely:
# mysql
mysql>
GRANT ALL PRIVILEGES ON *.* TO 'waseele'@'localhost'
IDENTIFIED BY 'waseele' WITH GRANT OPTION;
mysql>
GRANT ALL PRIVILEGES ON *.* TO 'waseele'@'%'
IDENTIFIED BY 'waseele' WITH GRANT OPTION;
mysql> exit;
Note the following bug and forum information for SELinux problems:
http://bugs.mysql.com/bug.php?id=12676
http://forums.mysql.com/read.php?11,39505,46941
Add your own comment.