Compiling lamp's mysql-5.5.28

Source: Internet
Author: User

Installing Mysql-5.5.28

Since the data stored by MySQL is getting bigger and larger, I recommend storing the data on the LVM file system.

1. Making LVM File system

There is no longer a production process here, assuming we have done an LVM and mounted it in the/mydata directory, where/mydata/data is the repository for the MySQL database.

2, new user MySQL and MySQL group, in a safe way to run

Since the MySQL database is in the running process and the group is MySQL, we must create a new user MySQL, and MySQL belongs to MySQL group.

#groupadd-R MySQL #-r represented as System group

#useradd-R-G MySQL MySQL

#chown-R Mysql.mysql/mydata/data

#这样就只有mysql用户才可以进入在 write the data in the/mydata/data directory.

3. Install and initialize the mysql-5.5.28

#tar XF mysql-5.5.28-linux2.6-i686.tar.gz-c/usr/local

#cd/usr/local

#ln-sv mysql-5.5.28-linux2.6-i686 MySQL

#cd MySQL

#chown-R mysql:mysql.

#scripts/mysql_install_db--user=mysql--datadir=/mydata/data

(#以mysql的身份来初始化数据库并指定数据的存放位置)

#chown-R Root. # (change the MySQL directory owner to Root to prevent the MySQL process from being compromised and will have all MySQL permissions)

4, for MySQL through the configuration file

#cd/usr/local/mysql

#cp support-files/my-large.cnf/etc/my.cnf

and edit the/ETC/MY.CNF, find this paragraph [mysqld], modify the value of Thread_concurrency to your number of CPUs multiplied by 2, for example, use the following line:
Thread_concurrency = 2

Also add the following line to specify where the MySQL data file will be stored:
DataDir =/mydata/data

Here's a little bit of explanation. MySQL has multiple configuration files, so the order in which MySQL loads the configuration files is:

/ETC/MY.CNF---->/ETC/MYSQL/MY.CNF---> $BASEDIR/my.cnf--->~/.my.cnf

5, for MySQL through the SYSV service script

#cd/usr/local/mysql

#cp Support-files/mysql.server/etc/rc.d/init.d/mysqld

#chmod +x/etc/rc.d/init.d/mysqld

6. Add to Service list

Chkconfig--add mysqld

If you want mysqld to boot automatically, you can use the Chkconfig mysqld on command to implement

The installation of MySQL is completed in 6 steps above and can be tested.

In order to use the MySQL installation to conform to the system usage specification and export its development components to the system, the following steps are required:
7, output the MySQL man manual to the man command to find the path:

To edit the/etc/man.config, add the following line:
Manpath/usr/local/mysql/man

8, output MySQL header file to the System header file path/usr/include:

This can be achieved by simply creating a link:
# Ln-sv/usr/local/mysql/include/usr/include/mysql

9. Output MySQL library file to the system library to find the path:

# echo '/usr/local/mysql/lib ' >/etc/ld.so.conf.d/mysql.conf

The system is then re-loaded into the system library:
# Ldconfig

9, modify the PATH environment variable, so that the system can directly use the relevant commands MySQL

You can create a file that ends with *.sh in the/etc/profile.d/directory

#vim/etc/profile.d/mysqld.sh

#添加如下行:

Export path= $PATH:/usr/local/mysql/bin

This allows MySQL to use its commands directly, without the need to enter an absolute path to use

Add one point here:

The MySQL server maintains two types of variables:
Server variables:
Defining MySQL Server Run characteristics
#SHOW GLOBAL VARIABLES [like ' STRING '];
State variables:
MySQL Server run statistics saved
#SHOW GLOBAL STATUS [like ' STRING ']

This article from the "Linux Learning Path" blog, declined reprint!

Compiling lamp's mysql-5.5.28

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.