# Download source files Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/ftp://ftp.ntu.edu.tw/pub/MySQL/ # Or Wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz # Creating users and groups # Create an msyql user and group Groupadd mysql Useradd-g mysql-s/usr/sbin/nologin # Create an installation directory Mkdir-p/usr/local/webserver/mysql # Create a database directory Mkdir-p/home/mysql/3306/data # Decompress Tar-zxvf mysql-5.5.17.tar.gz Cd mysql-5.5.17 # Compile and install mysql # When cmake is used, there is no need for so many parameters, as long as one-DCMAKE_INSTALL_PREFIX =/usr/local/webserver/mysql is enough. We can configure it in my. cnf. [Mysqld] to see if my. cnf after your copy has these settings. Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/webserver/mysql -DMYSQL_DATADIR =/home/mysql/3306/data -DDEFAULT_CHARSET = utf8 -DWITH_READLINE = 1 -DWITH_SSL = system -DWITH_EMBEDDED_SERVER = 1 -DENABLED_LOCAL_INFILE = 1 -DDEFAULT_COLLATION = utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE = 1 -DWITH_INNOBASE_STORAGE_ENGINE = 1 -DWITH_MEMORY_STORAGE_ENGINE = 1 -DWITH_DEBUG = 0 # Install mysql Make & make install # If you need to change the configuration Make clean Rm-f CMakeCache.txt # Copy the configuration file Cp support-files/my-medium.cnf/usr/local/webserver/mysql/my. cnf # Set permissions Chmod + x/usr/local/webserver/mysql Chown-R mysql. mysql/usr/local/webserver/mysql # Configure auto-start upon startup Cp/usr/local/webserver/mysql/support-files/mysql. server/etc/init. d/mysql Chmod + x/etc/init. d/mysql Chkconfig-list Update-rc.d mysql ults '/sbin/chkconfig-add mysql;/sbin/chkconfig mysql on' Chkconfig-list mysql # Modify my. cnf Configuration Vim/usr/local/webserver/mysql/my. cnf # [Mysqld] Add: Datadir =/home/mysql/3306/data Default-storage-engine = MyISAM # Optional values: Log-error =/home/mysql/3306/data/error. log Pid-file =/home/mysql/3306/data/mysql. pid User = mysql Tmpdir =/tmp # Install the default data table /Usr/local/webserver/mysql/scripts/mysql_install_db-basedir =/usr/local/webserver/mysql-datadir =/home/mysql/3306/data-user = mysql # Start MySQL /Usr/local/webserver/mysql/bin/mysqld_safe-defaults-file =/usr/local/webserver/mysql/my. cnf & # Or use # "&" Indicates running in the background /Etc/init. d/mysql start (service mysql start) # Test whether MySQL is started #1) check whether a mysql process exists Ps-ef | grep mysql #2) check whether the port is running Netstat-tnl | grep 3306 #3) read mysql version information /Usr/local/webserver/mysql/bin/mysqladmin version # So far, MySQL installation is complete |