MYSQL-5.5.38 Universal Binary Installation

Source: Internet
Author: User

1. System Environment: CentOS 6.5_x86

2, mysql-5.5.38-linux2.6-i686.tar.gz

The file name format for the MySQL binary distribution is mysql-version-os.tar.gz, where version is the release number (for example, 5.1.51) and the OS represents the type of operating system installed by the distribution (for example, linux-i686).



Why use a generic binary package?

Because often to install MySQL for testing, is generally used to install the source code, but because the source code installation needs to compile a long time, although the source code compilation performance is good, but we can fully adjust through the configuration file. And the source mode relies heavily on the operating system environment.

and the generic binary package can be easily ported, and the official has done the corresponding optimization options. So I recommend using a generic binary package to install MySQL.


What if I use a binary installation upgrade?

The upgrade Gets or is a binary compression package. At the time of installation, we create a link, then the upgrade directly to the directory to switch to the new MySQL directory.


installation process?

1. Create MySQL users and groups

[[email protected] ~]# groupadd-r mysql[[email protected] ~]# useradd-r-g mysql-s/sbin/nologin MySQL

2. Create MySQL data storage directory (recommended separate partition, and logical volume)

Here, I am directly lazy, in/mydata/data as the Data directory:

[[email protected] ~]# mkdir-pv/mydata/data because this directory MySQL user needs to read and write, so we change the owner, belong to the group Mysql[[email protected] ~]# chown-r MySQL: Mysql/mydata/data

3. Decompression

Usually, as usual, we are accustomed to extracting into the/USR/LOCAL/SRC directory

[[Email protected] ~]# tar XF mysql-5.5.38-linux2.6-i686.tar.gz-c/usr/local/src# in order to facilitate the upgrade, we create a soft link, the next time you upgrade, re-create this link [ [Email protected] ~]# cd/usr/local[[email protected] local]# ln-sv src/mysql-5.5.38-linux2.6-i686 mysql ' MySQL ' sr c/mysql-5.5.38-linux2.6-i686 '

In fact, this step is to provide a quick way to operate. In fact, do not establish a soft connection is also available, why do you want to do so?

Upgrade management is useful: A new version is created separately for a directory to store. If you upgrade MySQL. Just modify the directory to which the soft link is pointing.

4. Initialize the database

[Email protected] local]# cd/usr/local/mysql[[email protected] mysql]# scripts/mysql_install_db--basedir=/usr/local /mysql--datadir=/mydata/data--user=mysql#--basedir specify MySQL base directory #--datadir Specify Data Directory #--user Specify user

This step is critical. If this is not successful, check for any errors or missing actions.

For the sake of security, we change the MySQL program directory owner, belong to the group Root:root

[Email protected] mysql]# chown-r root:root/usr/local/src/mysql-5.5.38-linux2.6-i686/


5. Copy MySQL service startup script and configuration file

# Copy Service startup script [[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld# join Sysv[[email protected] mysql]# Chkconfig--add mysqld# Boot [[email protected] mysql]# chkconfig mysqld on# Copy configuration file [[email protected] mysql]# CP Support-fi Les/my-medium.cnf/etc/my.cnf

6. Start the service

[[Email protected] etc]# service mysqld startstarting MySQL ... success! [Email protected] etc]# NETSTAT-TULPN | grep 3306tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3834/mysqld # OK, we see mysqld listening on port 3306

7. Add the MySQL Bin directory to path

[[email protected] ~]# vim/etc/profile.d/mysql.sh# Add the following line of export path= $PATH:/usr/local/mysql/bin[[email protected] ~] # . /etc/profile.d/mysql.sh # Do some simple security settings, as prompted, select [Y/n][[email protected] mysql]#/usr/local/mysql/bin/mysql_secure_ Installation

8. Make some configuration

Modify Manpath Let man command can find MySQL help document

# vim/etc/man.config# Add the following content Manpath/usr/local/mysql/man

Add header File

# ln-sv/usr/local/mysql/include/usr/include/mysql '/usr/include/mysql ', '/usr/local/mysql/include '

Add a library file

#vim/etc/ld.so.conf.d/mysql.conf# Add the following content/usr/local/mysql/lib

Re-entry into force

# Ldconfig-v | grep MySQL

9. Use Tcmalloc for MySQL acceleration

Only today found in the MySQL provided by the binary package, has included the libtcmalloc.so, previously did not know (-__-)b

[[email protected] lib]# pwd/usr/local/mysql/lib[[email protected] lib]# ls | grep libtcmallibtcmalloc_minimal.so# Edit Mysqld_safe file [[email protected] bin]# vi/usr/local/mysql/bin/mysqld_safe# Add the following line to export ld_preload= "/usr/local/mysql/lib/libtcmalloc_minimal.so" # restart MySQL service [[email protected] ~]# service Mysqld restartshutting down MySQL. success! Starting MySQL ... success! [Email protected] bin]# Lsof-n | Grep-i tcmamysqld 4793 mysql mem REG 8,2 888700 14655/usr/local/src/mysql-5.5.38-linux2.6-i686 /lib/libtcmalloc_minimal.so


Knowledge Charging:

The role of the Ldconfig command is:
Ldconfig creates the necessary links and caches to the most recent GKFX libraries found in the directories specified on T He command line, in the file/etc/ld.so.conf, and in the trusted directories (/lib and/usr/lib). The cache is used by the RUN-TIME linker, ld.so or ld-linux.so. Ldconfig checks the header and filenames of the libraries it encounters when determining which versions should has their Links updated.

Ldconfig a few places to pay attention to!

1. To/lib and/usr/lib inside add things, is not modified/etc/ld.so.conf, but after the end to adjust ldconfig, otherwise the library will not find

2. If you want to add things to the above two directories, be sure to modify the/etc/ld.so.conf, and then call Ldconfig, otherwise you will not find

For example, install a MySQL to/usr/local/mysql,mysql there are a lot of libraries under the/usr/local/mysql/lib, then you need to add a line under/etc/ld.so.conf/usr/local/ Mysql/lib, after saving Ldconfig, the new library can be found when the program is running.

3. If you want to put Lib outside of these two directories, but do not want to add things in the/etc/ld.so.conf (or do not have permission to add things). That can also be, export a global variable ld_library_path, and then run the program will go to this directory to find the LIBRARY. In general, this is a temporary solution that is used when there is no authority or temporary need.

4. These things that ldconfig do are related to running the program, and have nothing to do with the compile time. Compile the time or the addition-l will have to add, do not confuse.

5. In short, it is no matter what you do about the library changes, it is best to ldconfig a bit, otherwise there will be some unexpected results. It won't take much time, but it will save a lot of things.


This article is from the "Share Your Knowledge" blog, so be sure to keep this source http://skypegnu1.blog.51cto.com/8991766/1440016

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.