First, install MySQL
1. Create a system user running a MySQL database, group (if there is no need to create)
[root@www ~] #useradd –m–s/sbin/nologin MySQL//No working directory, landing Shell for Prohibition
2. Unpack and release the source package and switch to the expanded source package directory
[root@www ~] #tar zxvf mysql-5.0.56.tar.gz-c/usr/src/
[root@www ~] #cd/usr/src/mysql-5.0.56
3. Use. Configure compilation configuration
[Root@www mysql-5.0.56]#./configure--prefix=/usr/local/mysql
4. Compile and install
[Root@www mysql-5.0.56] #make && make install
5. Post-Installation adjustments (examples here for midsize enterprises)
1). Set up a configuration file
[Root@www mysql-5.0.56] #cp suport-file/my-medium.cnf/etc/my.cnf
2). Initializing the database
[Root@www mysql-5.0.56]/usr/local/mysql/bin/mysql_install_db--user=mysql//as MySQL execution
[Root@www mysql-5.0.56]chown–r root.mysql/usr/local/mysql///Change Directory ownership
[Root@www mysql-5.0.56]chown–r Mysql/usr/local/mysql/var//Change Directory ownership
3). Adjust Lib Library path
[Root@www Mysql-5.0.56]echo "/usr/local/mysql/lib/mysql" >>/etc/ld.so.conf
[Root@www mysql-5.0.56]ldconfig//Refresh Dynamic Connection Library search path for changes to take effect
Second, MySQL start control
1. Use Mysqld_safe script to start the service securely
[Root@www mysql-5.0.56]/usr/local/mysql/bin/mysql_safe--user=mysql & Script Launch
[Root@www Mysql-5.0.56]netstat-ntpl | grep 3306//mysql use 3306 port for service by default
You can modify the port configuration line in the [Mysqld] block in the MY.CNF configuration file as needed
2. Add mysqld as a system service
The Mysql.server in the source Package Support_file folder can be replicated to the INIT.D directory as a service startup script and renamed to MySQL for use with chkconfig--add mysqld; chkconfig Mysqldon make it start
[Root@www MYSQL-5.0.56]CP Support-files/mysql.server/etc/init.d/mysqld
[Root@www mysql-5.0.56]chmod +x/etc/init.d/mysqld
[Root@www mysql-5.0.56]chkconfig--add mysqld
[Root@www mysql-5.0.56]chkconfig mysqld on
The above command enables the MYSQLD service to turn off the reboot via the service start Stop command
3. Set the execution path of the MySQL program
[Root@www mysql-5.0.56]export path= $PATH:/usr/local/mysql/bin
[Root@www Mysql-5.0.56]echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profile