1.安装准备
下载好软件
2.建立MySql帐号
[root@xiaoyu ~]# groupadd mysql 创建用户组
[root@xiaoyu ~]# useradd mysql -g mysql -M -s /sbin/nologin 创建用户,-g 属于mysql组,-M 不创建家目录,-s /sbin/nologin 不登陆
3.解压
[root@xiaoyu ~]# tar zxvf soft/mysql-5.1.72.tar.gz
4.安装配置
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
上述内容保存成mysql.log文件
cat /root/mysql.log | bash
5.安装 make;make install
6.初始化数据库
[root@xiaoyu support-files]# ls -al *.cnf
-rw-r--r--. 1 root root 4746 Jun 17 07:59 my-huge.cnf
-rw-r--r--. 1 root root 19779 Jun 17 07:59 my-innodb-heavy-4G.cnf
-rw-r--r--. 1 root root 4720 Jun 17 07:59 my-large.cnf
-rw-r--r--. 1 root root 4731 Jun 17 07:59 my-medium.cnf
-rw-r--r--. 1 root root 2499 Jun 17 07:59 my-small.cnf
[root@xiaoyu support-files]# cp my-small.cnf /etc/my.cnf 初始化配置文件
[root@xiaoyu support-files]# mkdir /application/mysql/data -p 创建数据存放目录
[root@xiaoyu support-files]# chown -R mysql.mysql /application/mysql/ 更改权限
初始化:
[root@xiaoyu support-files]# /application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
WARNING: The host 'xiaoyu' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
170617 8:56:44 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
170617 8:56:44 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/application/mysql/bin/mysqladmin -u root password 'new-password'
/application/mysql/bin/mysqladmin -u root -h xiaoyu password 'new-password'
Alternatively you can run:
/application/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /application/mysql ; /application/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /application/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /application/mysql/scripts/mysqlbug script!
7.复制启动脚本到启动目录
[root@xiaoyu mysql-5.1.72]# cp support-files/mysql.server.sh /etc/init.d/mysqld
[root@xiaoyu init.d]# chkconfig --add mysqld 设置开机启动
[root@xiaoyu init.d]# chkconfig mysqld on
直接启动:
添加PATH="/application/mysql/bin/:$PATH"
[root@xiaoyu init.d]# vim /etc/profile
[root@xiaoyu init.d]# source /etc/profile
8.修改init.d/mysqld ,让该启动方式生效
basedir=/application/mysql/
datadir=/application/mysql/data
9.为PHP安装做准备
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y 安装php用到的库
配置php
./configure --prefix=/application/php5.3.27 --with-apxs2=/application/apache/bin/apxs --with-mysql=/application/mysql --with-xmlrpc --with-openssl \
> --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir \
> --enable-short-tags --enable-sockets --enable-zend-multibyte --enable-soap \
> --enable-mbstring --enable-static --enable-gd-native-ttf \
> --with-curl --with-xsl --enable-ftp --with-libxml-dir
表示配置成功
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
make&make install