MySQL compilation and installation and compilation ParametersAdd a mysql group and a mysql user [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 modeMake & make install -- Enable-thread-safe-client/Compile the client in thread mode
Mysql directory permission settings Mkdir/usr/local/mysql/varMkdir/var/run/mysqldChmod + w/usr/local/mysql/
Chown-R mysql: mysql/usr/local/mysql/Chown-R mysql: mysql/var/run/mysqldCp/usr/local/mysql/share/mysql/my-innodb-heavy-4G.cnf/etc/my. cnfInitialize 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 configBasedir =/usr/local/mysql literal mysql program directory
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&