I. Virtual Environment preparation
Virtual Machine: VMware Workstation
System: CentOS6.0 (64Bit) Basic installation
Ii. Related Components
Cmake: http://www.cmake.org/
Bison http://www.gnu.org/s/bison/
Mysql: http://www.mysql.com/
M4: http://www.gnu.org/s/m4/
3. Download and install components
[Root @ CentOS ~] # Cd/usr/src/
[Root @ CentOS src] # wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
[Root @ CentOS src] # wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
[Root @ CentOS src] # wget http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.5/mysql-5.5.16.tar.gz
[Root @ CentOS src] # wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz
(1) install cmake and bison
[Root @ CentOS src] # tar-zxvf cmake-2.8.5.tar.gz
[Root @ CentOS src] # cd cmake-2.8.5
[Root @ CentOS cmake-2.8.5] #./bootstrap
[Root @ CentOS cmake-2.8.5] # make
[Root @ CentOS cmake-2.8.5] # make install
[Root @ CentOS cmake-2.8.5] # cmake -- version
Cmake version 2.8.5
[Root @ CentOS src] # tar-zxvf bison-2.5.tar.gz
[Root @ CentOS src] # cd bison-2.5
[Root @ CentOS bison-2.5] #./configure
[Root @ CentOS bison-2.5] # make
[Root @ CentOS bison-2.5] # make install
[Root @ CentOS bison-2.5] # bison -- version
Bison (GNU Bison) 2.4.1
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
Warranty; not even for MERCHANTABILITY or fitness for a particle PURPOSE.
(2) mysql Installation
[Root @ CentOS src] # tar-zxvf mysql-5.5.16.tar.gz
[Root @ CentOS src] # cd mysql-5.5.16
[Root @ CentOS mysql-5.5.16] # groupadd mysql www.2cto.com
[Root @ CentOS mysql-5.5.16] # useradd-g mysql
[Root @ CentOS mysql-5.5.16] # cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
>-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \
>-DDEFAULT_CHARSET = utf8 \
>-DDEFAULT_COLLATION = utf8_general_ci \
>-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk, gb2312 \
>-DWITH_MYISAM_STORAGE_ENGINE = 1 \
>-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
>-DWITH_MEMORY_STORAGE_ENGINE = 1 \
>-DWITH_READLINE = 1 \
>-DENABLED_LOCAL_INFILE = 1 \
>-DMYSQL_DATADIR =/var/mysql/data \
>-DMYSQL_USER = mysql
Same Function
[Root @ CentOS mysql-5.5.16] # cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk, gb2312-runtime = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-runtime = 1-DWITH_READLINE = 1-DENABLED_LOCAL_INFILE = 1-DMYSQL_DATADIR =/var/mysql/data-DMYSQL_USER = mysql
[Root @ CentOS mysql-5.5.16] # make
[Root @ CentOS mysql-5.5.16] # make install
[Root @ CentOS mysql-5.5.16] # chmod + w/usr/local/mysql
[Root @ CentOS mysql-5.5.16] # chown-R mysql: mysql/usr/local/mysql
[Root @ CentOS mysql-5.5.16] # cd/usr/local/mysql/lib
[Root @ CentOS lib] # ls
Libmysqlclient. a libmysqlclient_r.so.18 libmysqlclient. so.18 plugin
Libmysqlclient_r.a libmysqlclient_r.so.18.0.0 libmysqlclient. so.18.0.0
Libmysqlclient_r.so libmysqlclient. so libmysqlservices.
[Root @ CentOS lib] # ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib/libmysqlclient. so.18 32Bit
[Root @ CentOS lib] # ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib64/libmysqlclient. so.18 64Bit
[Root @ CentOS src] # cd/usr/src/mysql-5.5.16
[Root @ CentOS mysql-5.5.16] # mkdir-p/var/mysql/
[Root @ CentOS mysql-5.5.16] # mkdir-p/var/mysql/data/
[Root @ CentOS mysql-5.5.16] # mkdir-p/var/mysql/log/
[Root @ CentOS mysql-5.5.16] # chown-R mysql: mysql/var/mysql/
[Root @ CentOS mysql-5.5.16] # cp/usr/src/mysql-5.5.16/support-files/my-large.cnf/var/mysql/my. cnf
[Root @ CentOS mysql-5.5.16] # cp/usr/src/mysql-5.5.16/support-files/mysql. server/etc/init. d/mysqld
[Root @ CentOS mysql-5.5.16] #/usr/local/mysql/scripts/mysql_install_db \
> -- Defaults-file =/var/mysql/my. cnf \
> -- Basedir =/usr/local/mysql \
> -- Datadir =/var/mysql/data \
> -- User = mysql
Same Function
[Root @ CentOS mysql-5.5.16] #/usr/local/mysql/scripts/mysql_install_db -- defaults-file =/var/mysql/my. cnf -- basedir =/usr/local/mysql -- datadir =/var/mysql/data -- user = mysql
[Root @ CentOS mysql-5.5.16] # chmod + x/etc/init. d/mysqld
[Root @ CentOS mysql-5.5.16] # vim/etc/init. d/mysqld (modify)
Basedir =/usr/local/mysql
Datadir =/var/mysql/data
[Root @ CentOS mysql-5.5.16] # chkconfig -- add mysqld
[Root @ CentOS mysql-5.5.16] # chkconfig -- level 345 mysqld on
[Root @ CentOS mysql-5.5.16] # service mysqld start
Starting MySQL... SUCCESS!
[Root @ CentOS tmp] # mysqladmin-u root-p password 123.com
Enter password:
Iv. FQA FAQs
① [Root @ CentOS mysql-5.5.16] # service mysqld start
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/CentOS. LNMP. pid ).
Solution:
[Root @ CentOS mysql-5.5.16] # mv/etc/my. cnf my. cnf. bakcup
② [Root @ CentOS mysql-5.5.16] # mysqladmin-u root-p password 123.com
Enter password:
Mysqladmin: connect to server at 'localhost' failed
Error: 'Can't connect to local MySQL server through socket '/var/lib/mysql. sock' (2 )'
Check that mysqld is running and that the socket: '/var/lib/mysql. sock' exists!
Solution:
[Root @ CentOS mysql-5.5.16] # vim/var/mysql/my. cnf
Socket =/tmpl/mysql. sock modify socket =/var/lib/mysql. sock
[Root @ CentOS tmp] # ln-s/tmp/mysql. sock/var/lib/mysql/
[Root @ CentOS tmp] # mysqladmin-u root-p password 123.com
Enter password:
Contact: QQ: 64324613
This article is from the "13975309974" blog