[Root @ centos MySQL] # groupadd MySQL
[Root @ centos MySQL] # useradd-G MySQL
Compilation and Installation Tar-zxvf mysql-5.1.35.tar.gz ./Configure \
-- Prefix =/usr/local/MySQL \
-- Localstatedir =/data/MySQL/data \MySQL DATA DIRECTORY
-- Enable-Cycler \
-- With-mysqld-ldflags =-rdynamic \
-- With-client-ldflags =-all-Static\
-- With-plugins = Innobase, partition \
-- With-extra-charsets = none \
-- Enable-thread-safe-client \ -- With-client-ldflags =-all-static
\Compile the client in pure static mode
-- With-mysqld-ldflags =-all-staticCompile server in pure static mode Make & make install -- Enable-thread-safe-Client
\ Compile the client in thread mode
MySQL directory permission settings
Mkdir/usr/local/MySQL/var Mkdir/var/run/mysqld Chmod + w/usr/local/MySQL/
Chown-r MYSQL: MySQL/usr/local/MySQL/ Chown-r MYSQL: MySQL/var/run/mysqld CP/usr/local/MySQL/share/MySQL/my-innodb-heavy-4G.cnf/etc/My. CNF
Initialize a database table as a MySQL user /Usr/local/MySQL/bin/mysql_install_db -- basedir =/usr/local/MySQL -- datadir =/data/MySQL/data -- user = MySQL -- Datadir =/data/MySQL/Data define the MySQL data storage directory
Note:If you define a data directory to another directory, you must first modify the/etc/My. CNF file and add the following two lines [Mysqld] # Generic configuration options
Port = 3306
Socket =/tmp/MySQL. Sock # WB config Basedir =/usr/local/MySQL literal MySQLProgramDirectory
Datadir =/data1/MySQL/data definition data directory Initialize the table for the database. Otherwise, an error will be reported when the MySQL database is started.
Start MySQL Service /Usr/local/MySQL/bin/mysqld_safe -- user = MySQL -- datadir =/data/MySQL/data (specify the database directory)
/Usr/local/MySQL/bin/mysqld_safe -- user = MySQL 2> & 1>/dev/Null&