CentOS Linux installation under MySQL 5.1.x

MySQL 5.1.x under CentOS Linux installation, optimization and security configuration

Download page: **dev.mysql**/downloads/mysql/5.1.html # downloads

groupadd mysql
Create a new user group called mysql
useradd-g mysql mysql
In the mysql user group, create a new user named mysql

shell> tar zxvf / path / to / mysql-VERSION-OS.tar.gz
Extract the downloaded tar.gz file to
cd mysql-VERSION
Into the unpacked directory
CFLAGS = "-O3-mcpu = pentium4" CXX = gcc CXXFLAGS = "-O3-march = pentium4-felide-constructors-fno-exceptions-fno-rtti". / Configure-prefix = / home / mysql /-without-debug -with-unix-socket-path = / home / mysql / tmp / mysql.sock-with-client-ldflags =- all-static-with-mysqld-ldflags =- all-static-enable-assembler-with-extra- charsets = gbk, gb2312, utf8-without-innodb-without-isam-with-pthread-enable-thread-safe-client
Configuration mysql
gcc-related parameters:

Optimized for large functions, optimizing compilers take a little more time and a large memory.
Do not use `-O 'option, the compiler's goal is to reduce the cost of compilation, so the results can compile debug. Statements are independent: if you use the breakpoint between the two statements to stop the program, any variable you can re- assignment, or in the body of the function to the program counter to other statements, and accurately from the source to get results you would expect.
Do not use `-O 'option, the only variable was declared register allocation registers. Compile results than without`-O' option by PCC.
Use `-O 'option, the compiler tries to reduce code size and execution time.
If you specify `-O 'option,`-fthread-jumps' and `-fdefer-pop 'option will be opened in a delay slot machines,`-fdelayed-branch' option will be opened in Even without a frame pointer (frame pointer) also supports the debugging of the machine, `-fomit-frame-pointer 'option is turned on. Some machines may also open other options.

Optimize even more. In addition to involving the exchange of space and speed optimization options, the implementation of almost all of the optimization, such as not to loop unrolling (loop unrolling) and the function inline (inlining). And-O options of comparison, this option only increased compile time and run the generated code to improve the effect.
More optimized addition to open-O2 done, it opens-finline-functions option.
Not optimized.
If multiple-O options, whether with or without figures, the last option is the option to take effect.
-Mcpu = pentium4 optimizing compiler based on CPU type, you can make your mysq perform better! Optional Item number: i386, i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp , athlon-mp, winchip-c6, winchip2, c3.
-Fomit-frame-pointer for the stack pointer does not require a function pointer is not stored in the register, so you can ignore the code to store and retrieve addresses and register for general purposes. All "-O" level are open with an option, but only in the debugger, the stack pointer can not rely on when it is running. Proposal does not require debugging in the case explicitly set it.

configure the relevant parameters:
-Prefix = / home / mysql / specify the installation directory-without-debug to remove the debug-with-extra-charsets = gbk, gb2312, utf8 add gbk, gb2312, utf8 Chinese characters support-with-pthread forced to use the pthread library (posix Thread Library)
-Enable-assembler to use some character functions compiled version-enable-thread-safe-client compile a thread-way clients-with-client-ldflags =- all-static to statically compile a pure client-with-mysqld-ldflags = -all-static to statically compile a pure server-without-isam isam tables to remove the type of support, is now rarely used, isam table is a platform-table-without-innodb support removed innodb table, innodb is a kinds of support the transaction table, suitable for enterprise applications

make install
cp support-files/my-medium.cnf / etc / my.cnf
Copy the mysql configuration file to the / etc directory, and renamed my.cnf

/ Home / mysql following five my-**x.cnf file
my-small.cnf Installation with minimum configuration, memory <= 64M, the smallest number of data
my-large.cnf memory = 512M
my-medium.cnf 32M <memory <64M, or memory with 128M, but the common memory database and web server
my-huge.cnf 1G <memory <2G, the main server running mysql
my-innodb-heavy-4G.cnf maximum configuration installation, memory, at least 4G

cd / home / mysql
Into the installation directory
bin / mysql_install_db-user = mysql
Mysql user's identity in order to initialize the grant tables
chown-R root.
The mysql home directory (ie / home / mysql) the owner set to root user. This is the official document on the command, but the strange thing is, if the owner's home directory mysql set root user, run the following bin / mysqld_safe-user = mysql & can not be started after the mysql. The problem lies in the "Permissions", run chown-R mysql. You can start with the following command mysql. Is the official document is wrong? I hope that everyone up and explore.
chown-R mysql var
Will set the var directory is the main mysql user
chgrp-R mysql.
Home directory of the mysql set the mysql user group owner (note: not the same as the previous command, this command is to empower the user group)
bin / mysqld_safe-user = mysql &
Start mysql, if all goes well, run this command without any prompt.
bin / mysqladmin-u root password password
Modify the root password, here the root user is the mysql root user has nothing to do with the Linux root user. Green is the password you need to set a new password, remember!
bin / mysql-u root-p
If normal, you can login using this name, after entering the password, there mysql> The prompt indicates that the login is successful. With the quit command to exit

The following command is used to set the mysql start automatically
cd mysql-VERSION
Re-enter the unzipped directory, that is the source directory.
cp support-files/mysql.server / etc / init.d / mysql
Will copy the file mysql.server to / etc / init.d / directory, and changed its name to mysql
chmod 755 / etc / init.d / mysql
To / etc / init.d / mysql file given "execute"
chkconfig-level 345 mysql on
Added to start automatically, run level 3 4 5
service mysql restart
Restart mysql service
标签: execution time, frame pointer, tar zxvf, o3, innodb, client configuration, breakpoint, mysqld, linux installation, security configuration, register allocation, groupadd, unix socket, isam, fno, charsets, new user group, mysql user group, delay slot, downloaded tar
分类: OS
时间: 2011-05-16


  1. Linux installation uninstall Mysql database

    I. Introduction Want to use Linux for a long time, because there is no hard task has been no systematic study ...
  2. centos (linux) garbled under mysql encoding settings

    Keywords: cent os (linux), MySQL, garbled cent os install mysql client and the server, the garbled, had to mod ...
  3. CentOS Linux install under the MySQL 5.1.x

    MySQL 5.1.x under CentOS Linux installation, optimization and security configuration Download page: http://dev ...
  4. Uninstalling under Linux and the MySQL installation

    Introduce mysq installation First, the preparation: 1. As redhat Enterprise 5 comes with a version of mysql, i ...
  5. linux software installation (jdk, mysql, tomcat)

    linux software installation (jdk, mysql, tomcat) (2009-06-26 21:11:21) Run the installation file / Etc / profi ...
  6. Mysql Linux installation notes

    redhat install mysql notes First, prepare the installation files: MySQL-server-community-5.0.45-0.rhel4.i386.r ...
  7. mysql under linux installation and use, remote connection;

    The system is Red Hat Enterprise Linux 5 64-bit mysql MySQL-client-community-5.1.53-1.rhel5.i386.rpm; MySQL-se ...
  8. Installation under Linux configuration information MySqL

    1 to achieve a pure manual MySQL source code under linux install, download the MySQL source code, I downloaded ...
  9. linux下的lnmp(CentOS linux+nginx+mysql+php+zend + eAccelerator)的应用介绍

    linux下的lnmp(CentOS linux+nginx+mysql+php+zend + eAccelerator)的应用介绍 lnmp是(CentOS Linux+Nginx+MySQL+PHP)组合的简写,是最 ...
  10. linux下的lamp(CentOS linux+apache+mysql+php+zend + eAccelerator)的应用介绍

    linux下的lamp(CentOS linux+apache+mysql+php+zend + eAccelerator)的应用介绍 lamp是(CentOS Linux+Apache+MySQL+PHP)组合的简写, ...
  11. Linux comes with Mysql.Apache.Php uninstall

    Linux comes with Mysql, Apache, Php uninstall Many people do not want to use Linux comes with Mysql, Apache, P ...
  12. compile php under linux installation parameters

    compile php under linux installation parameters Fast-CGI: . / Configure - prefix = / usr / local / php - enabl ...
  13. Linux installation and configuration under the MySQL5.0.90

    1, download the installation files for MySQL MySQL installation requires the following two files: MySQL-server ...
  14. CentOS LAMP installation

    CentOS wide range of sources used. This time we want in terms of how to use the CentOS installation source LAM ...
  15. Elaborate package for Linux Installation and Management

    Original: A source installation Linux operating system as open sour ...
  16. Grub4Dos hard drive to install Fedora / CentOS Linux operating system

    From the hard disk Linux / GNU operating system, there is no CD-ROM drives and recordable discs convenient fea ...
  17. Linux installation and configuration under MySQL5.0.90

    1, download the MySQL installation files MySQL installation requires the following two files: MySQL-server-5.0 ...
  18. Mongodb of Windows & Linux Installation and Precautions

    Mongodb Windows installation and precautions: 1 download mongodb the windows version (note that 32-bit and 64- ...
  19. lanmp(Linux Apache Nginx Mysql Php) 的安装配置

    lanmp(Linux Apache Nginx Mysql Php) 的安装配置,需要的朋友可以参考下. 1 ) 安装Centos 5 , 下载地址 ...