目前各大门户网站均在一定程度上偏向mysql的使用,加上阿里系倡导的去I/O/E运动,先前一直轻视mysql的观点必须要改正下,况且做为一个数据库从业者,必须要熟悉2种以上的rdbms数据库,因而今后的学习重点依然是oracle,mysql则作为一个延伸方向!本文主要记录mysql5.5版本在linux平台的编译安装过程,mysql在5.1和5.5版本上存在比较大的差别,5.1之后提供了分区表的功能,5.5版本上默认的存储引擎改为innodb,5.1之前则是myisam
1:安装必要的rpm包,创建mysql用户组,本文采用的操作系统平台为rhel5.4
[root@dg53 ~]# grep -v '^#' /etc/yum.repos.d/base.repo |grep -v '^$'
[base]
name=base
baseurl=file:///mnt/Server
gpgcheck=0
enable=1
[root@dg53 ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@dg53 ~]# yum -y install gcc gcc-c++ gcc-g77 autoconf automake \
zlib* fiex** libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
[root@dg53 ~]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)
2:下载cmake和mysql源码包,进行编译安装,mysql5.5版本需要使用cmake编译
[root@dg53 ~]# cd /usr/local/src/tarbag/
[root@dg53 tarbag]# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
[root@dg53 tarbag]# wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.25.tar.gz
[root@dg53 tarbag]# tar -zxvpf cmake-2.8.4.tar.gz -C ../software/
[root@dg53 tarbag]# tar -zxvpf mysql-5.5.25.tar.gz -C ../software/
[root@dg53 tarbag]# cd ../software/cmake-2.8.4/
[root@dg53 cmake-2.8.4]# ./configure --prefix=/usr/local/cmake2.8.4 && make && make install
[root@dg53 ~]# grep PATH .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/cmake2.8.4/bin:$PATH
export PATH
[root@dg53 ~]# . .bash_profile
[root@dg53 ~]# cd /usr/local/src/software/mysql-5.5.25/
[root@dg53 mysql-5.5.25]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5.25 \
-DMYSQL_DATADIR=/mydata \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_DEBUG=0
[root@dg53 mysql-5.5.25]# make && make install
3:初始化mysql服务
[root@dg53 mysql-5.5.25]# cp support-files/my-large.cnf /etc/my.cnf
[root@dg53 mysql-5.5.25]# cp support-files/mysql.server /etc/init.d/mysqld
[root@dg53 mysql-5.5.25]# chmod +x /etc/init.d/mysqld
[root@dg53 mysql-5.5.25]# chkconfig --add mysqld
[root@dg53 mysql-5.5.25]# sh ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5.5.25/ --datadir=/mydata/
[root@dg53 mysql-5.5.25]# service mysqld start
Starting MySQL...[ OK ]
[root@dg53 ~]# echo '/usr/local/mysql5.5.25/include/' >> /etc/ld.so.conf
[root@dg53 ~]# echo '/usr/local/mysql5.5.25/lib/' >> /etc/ld.so.conf
[root@dg53 ~]# ldconfig
4:测试安装结果
[root@dg53 mysql-5.5.25]# /usr/local/mysql5.5.25/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.25-log Source distribution
Copyright (c) 2000, 2011, 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> select user,password,host from mysql.user;
+------+----------+---------------+
| user | password | host |
+------+----------+---------------+
| root | | localhost |
| root | | dg53.yang.com |
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | dg53.yang.com |
+------+----------+---------------+
6 rows in set (0.00 sec)
mysql> show plugins;
+-----------------------+--------+--------------------+---------+---------+
| Name | Status | Type | Library | License |
+-----------------------+--------+--------------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
+-----------------------+--------+--------------------+---------+---------+
17 rows in set (0.00 sec)
mysql> show variables like '%default%';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
| default_week_format | 0 |
+------------------------+--------+
2 rows in set (0.00 sec)
mysql> show variables like '%character%';
+--------------------------+----------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql5.5.25/share/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.00 sec)
©著作权归作者所有:来自51CTO博客作者ylw6006的原创作品,谢绝转载,否则将追究法律责任
mysqllinux系统installMysql
共同学习,写下你的评论
评论加载中...
作者其他优质文章