Before CentOS 6.2 was compiled and installed, MySQL 5.5.25 was installed on ubuntu. Later, my colleagues said that the general servers were installed on centos, so they reset the centos system. Of course, you must first set up the PHP environment at www.2cto.com. The downloaded source code mysql is 5.5.25, and the latest version seems to be 5.5.4. Remember to download the Source Code. When you download the Source Code from the mysql official website, you will be prompted to select a platform and select the bottom Source Code from the drop-down menu. After installing ubuntu, you cannot start mysql. The error code is "The server quit without updating PID file (/var/lib/mysql/CentOS. pid) ", Baidu and google both searched for some information, which is basically the same. It didn't help me, and it won't work even if they modified the information as they said. As a result, Zhang's blog is combined to achieve the final success.
Step 1: first install the dependent libraries and development tools # dependent libraries and development tools
Yum-y install gcc-c ++ autoconf libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses- devel curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn-devel openssl-devel openldap-devel nss_ldap openldap-clients openldap-servers www.2cto.com # Ngin Xyum-y install pcre-devel zlib-devel # Phpyum-y install gd-devel libjpeg-devel libpng-devel freeetype-devel libxml2-devel curl-devel freetype-devel # Mysqlyum-y install bison gcc-c ++ autoconf automake zlib * libxml * ncurses-devel libtool-ltdl-devel * mysql-devel Step 2: since mysql5.5 is started, instead of using configure for installation, cmake is used. So you need to first install the cmakewget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gztar-zxvf cmake-2.8.6.tar.gzcd cmake-2.8.6/./configuremake & make install
Step 3: Install mysql using cmake (I have downloaded the mysql source code file, put it in a USB flash drive, and copy it to the/tmp directory) // enter the/tmp directory tar-zxvf mysql-5.5.25.tar.gzcd mysql-5.5.25 www.2cto.com cmake \-DCMAKE_INSTALL_PREFIX =/usr/local/webserver/mysql \-DMYSQL_DATADIR =/user/local/webserver/mysql/data \-DSYSCONFDIR =/etc \-DEXTRA_CHARSETS = all \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-DWITH_INNOBASE_STORAGE_ENGINE = 1 \-prop = 1 \-DW ITH_BLACKHOLE_STORAGE_ENGINE = 1 \-DWITH_FEDERATED_STORAGE_ENGINE = 1 \-DWITH_PARTITION_STORAGE_ENGINE = 1 \-runtime = 1 \-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock \-DMYSQL_TCP_PORT = 3306 \-DWITH_DEBUG = 0 \-DENABLED_LOCAL_INFILE = 1 Press enter to execute. After the execution is complete, continue to execute make & make install Step 4: set mysql # Set Mysql # There are five configuration information files in the support-files directory (it is important to copy the corresponding cnf files according to your memory, otherwise mysql always fails): www.2cto.com # my-small.cnf (memory <= 64 M) # My-medium.cnf (memory 128 M) # my-large.cnf (memory 512 M) # my-huge.cnf (memory 1G-2G) # my-innodb-heavy-4G.cnf (memory 4 GB) cd/usr/local/webserver/mysqlcp. /support-files/my-huge.cnf/etc/my. cnf vi/etc/my. cnf # Add datadir =/data/mysqlwait-timeout = 30max_connections = 512default-storage-engine = MyISAM # modify max_allowed_packet = 16 M in [mysqld]. Step 5: add mysql users and user groups to generate a new mysql authorization table // Add mysql running users and user groups groupadd mysqluser Add-g mysql-s/bin/false-d/home/mysql // no shell, cannot log on to the Local Machine (for security reasons) www.2cto.com cd/usr/local/webserver/mysqlchown-R root. chown-R mysql datachgrp-R mysql. // generate a new mysql authorization table // enter the script directory cd/usr/local/webserver/mysql/scripts // generate a new mysql authorization table using the mysql_install_db script. /mysql_install_db -- basedir =/usr/local/webserver/mysql -- datadir =/usr/local/webserver/mysql/data -- user = mysql // mysql server Service in the system Set/copy the service file and modify cd/usr/local/webserver/mysql/support-filescp mysql. server mysqld // modify mysqldbasedir =/usr/local/webserver/mysqldatadir =/usr/local/webserver/mysql/data www.2cto.com mv mysqld/etc/init. d/mysqldchmod 755/etc/init. d/mysqld // set the soft connection to enable mysql, mysqldump, the three bin commands of mysqladmin can directly run sudo ln-s/usr/local/webserver/mysql/bin/mysql/usr/binsudo ln-s/usr/local/in shell/ webserver/mysql/bin/mysqldump/us R/binsudo ln-s/usr/local/webserver/mysql/bin/mysqladmin/usr/bin rm-rf/etc/mysql/my. cnf has copied this file to/etc/my. if cnf is not deleted, mysql cannot be started. Step 6: Start mysql and set the mysql user name and password/etc/init. d/mysqld start // set the root password mysqladmin-u root password "admin" www.2cto.com // fix Chinese garbled characters in mysql database vi/etc/my. cnf // then add character-set-server = utf8 // under the [mysqld] configuration option and enter the mysqlcd/usr/local/webserver/mysql/binmysql-u root-p prompt enter the password mysql> show variables like '% character % '; // result: Both character_set_database and character_set_server are changed to utf8 by HQER.