# Switch to mysql extract Directory Cd/usr/local/src/mysql-5.5.25 # Create a directory Mkdir-pv/usr/local/mysql/data # Create a mysql user and a mysql Group Groupadd mysql 2 useradd-g mysql-s/usr/sbin/nologin mysql # Cmake compilation Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-plugin =/usr/local/mysql/data-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = export-DWITH_READLINE = 1-DWITH_SSL = system-plugin = 1-DENABLED_LOCAL_INFILE = 1-DDEFAULT_COLLATION = utf8_general_ci-DWITH_MYISAM_STORAGE_ENGINE = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-DWITH_DEBUG = 0 # Installation Make & make install # Copy the configuration file Cp./support-files/my-medium.cnf/etc/my. cnf # Set permissions Chmod + x/usr/local/mysql 2 chown-R mysql: mysql/usr/local/mysql 3 chown-R mysql: mysql/usr/local/mysql/data # Configure automatic start upon startup Cp./support-files/mysql. server/etc/init. d/mysqld 2 chmod + x/etc/init. d/mysqld 3 chkconfig -- add mysqld 4 chkconfig mysqld on # Add a MySQL soft link to adapt to the init script Ln-sv/usr/local/mysql/bin/mysql/usr/sbin/mysql 2 ln-sv/usr/local/mysql/bin/mysqladmin/usr/sbin/mysqladmin 3 ln-sv/usr/local/mysql/bin/mysqldump/usr/sbin/mysqldump # Modifying the configuration file Vim/etc/my. cnf # Add in [mysqld: Datadir =/usr/local/mysql/data 2 log-error =/usr/local/mysql/data/error. log 3 pid-file =/usr/local/mysql/data/mysql. pid 4 user = mysql 5 tmpdir =/tmp # Save and exit # Initializing a database /Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data Configure the firewall to enable Port 3306 Vim/etc/sysconfig/iptables # Add the following rule to Port 3306. -A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT # Restarting the firewall /Etc/init. d/iptables restart # or service iptables restart Start MySQL Service mysqld start # or/etc/init. d/mysqld start Test whether MySQL is started # Check whether a mysql process exists Ps-ef | grep mysql # Check whether the mysql Port exists Netstat-tnlp | grep 3306 # Test whether the mysql, mysqladmin, and mysqldump commands can be used normally # Read MySQL version information Mysqladmin version |