全新以最小化包安装了64位的CentOS5.8系统
mysql5.5数据库v5.5.28
×××地址:http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz
mysql从5.5版本开始,不再使用./configure编译,而是使用cmake编译器
我的mysql目录配置如下:
安装路径:/usr/local/mysql
数据库路径:/data/mysql
源码包存放位置:/root/
下面开始安装:
1:看看我的系统是的版本号 使用uname -a
[root@localhost mysql-5.5.28]# uname -a
Linux localhost.localdomain 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost mysql-5.5.28]#
2:下载包。
[root@localhost ~]# cd
[root@localhost ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz
3:安装基本依赖包: cmake、automake 、autoconf ,另MySQL 5.5.x需要最少安装的包有:bison,gcc、gcc-c++、ncurses-devel
[root@localhost ~]# yum install cmake make -y
[root@localhost ~]# yum install gcc gcc-c++ autoconf bison automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* -y
4:开始解压安装 mysql
[root@localhost ~]# cd
[root@localhost ~]# tar zxvf mysql-5.5.28.tar.gz
[root@localhost ~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/data/mysql/ \
-DMYSQL_TCP_PORT=3306
[root@localhost ~]# make && make install
[root@localhost ~]#
5: 新建用户和组
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd mysql -g mysql -s /sbin/nologin
6:新建目标和改属主
[root@localhost ~]# mkdir -p /data/mysql
[root@localhost ~]# chwon -R mysql:mysql /data/mysql
[root@localhost ~]# chown mysql.mysql -R /usr/local/mysql
[root@localhost ~]# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf #新建配置文件
[root@localhost ~]# chmod 755 scripts/mysql_install_db
7:mysql 启动及自启动配置
[root@localhost ~]# cd /usr/local/mysql
[root@localhost mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql]# chmod 755 /etc/init.d/mysqld
[root@localhost mysql]# chkconfig --add mysqld
[root@localhost mysql]# chkconfig --level 35 mysqld on
[root@localhost mysql]# PATH="$PATH:/usr/local/mysql/bin"
[root@localhost mysql]# export PATH
8:启动mysql
[root@localhost mysql]# service mysqld start
Starting MySQL...[确定]
9:登录mysql
[root@localhost mysql]# /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.28-log Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
至此,mysql安装已经全部结束