linux上mysql5.5.8安装详解

MySQL5.5源码安装和以前的5.x有区别,5.x使用autotool编译,新版的5.5使用CMake编译

1.1. Cmake的安装

http://www.cmake.org/cmake/resources/software.html

下载源码包,安装cmake方法和其他的安装相同,解压,配置,编译,安装
cmake安装

1 [root@woyoo software]# tar zxvf cmake-2.8.3.tar.gz
2 [root@woyoo software]# cd cmake-2.8.3
3 [root@woyoo cmake-2.8.3]# ./configure
4 [root@woyoo cmake-2.8.3]# make
5 [root@woyoo cmake-2.8.3]# make install

建立用户和目录

1 [root@woyoo app]# groupadd mysql
2 [root@woyoo app]# useradd -g mysql mysql
3 [root@woyoo app]# groupadd www
4 [root@woyoo app]# useradd -g www www
5 [root@woyoo app]# mkdir -p /app/www
6 [root@woyoo app]# mkdir -p /app/mysql/data
7 [root@woyoo app]# chown -R mysql.mysql /app/mysql/data
8 [root@woyoo app]# chown -R www.www /app/www

注意:

1 [root@woyoo support-files]# ls *.cnf
2 my-huge.cnf  my-innodb-heavy-4G.cnf  my-large.cnf  my-medium.cnf  my-small.cnf

下面的配置过程中,ls一下你会看到有下面的文件: my-huge.cnf 【对应1-2G内存】、my-large.cnf 【对应512M内存】、my-medium.cnf 【对应128M内存】、my-small.cnf 【对应64M或更低】,你可以查看这些文件,参照你的电脑配置,选择一个文件

mysql开始安装

01 [root@woyoo software]# tar zxvf mysql-5.5.8.tar.gz
02 [root@woyoo software]# cd mysql-5.5.8
03 [root@woyoo mysql-5.5.8]# cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql  -DINSTALL_DATADIR=/app/mysql/data  -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all  -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1
04 [root@woyoo mysql-5.5.8]# make
05 [root@woyoo mysql-5.5.8]# make instal
06 [root@woyoo mysql-5.5.8]# cd /app/mysql/
07 [root@woyoo mysql]# ./scripts/mysql_install_db --basedir=/app/mysql --datadir=/app/mysql/data --user=mysql
08 [root@woyoo mysql]# cp ./support-files/my-medium.cnf /etc/my.cnf
09 [root@woyoo mysql]# cp ./support-files/mysql.server /etc/init.d/mysqld
10 [root@woyoo mysql]#ln -s /apt/mysql/lib/lib* /usr/lib/
11 [root@woyoo mysql]# chown -R mysql.mysql /app/mysql/
12 [root@woyoo mysql]# ./bin/mysqld_safe --user=mysql &
13 [root@woyoo mysql]# /app/mysql/bin/mysqladmin -u root password 'woyoo.cn'
14 [root@woyoo mysql]# /app/mysql/bin/mysql -uroot -pwoyoo.cn
15  
16 Welcome to the MySQL monitor.  Commands end with ; or \g.
17 Your MySQL connection id is 1
18 Server version: 5.5.8-log Source distribution
19 Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
20 Oracle is a registered trademark of Oracle Corporation and/or its
21 affiliates. Other names may be trademarks of their respective
22 owners.
23 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
24 mysql>

服务相关

view source print ?
01 [root@woyoo mysql]# chkconfig --add mysqld
02 [root@woyoo mysql]# chkconfig --level 35 mysqld on
03 [root@woyoo mysql]# service mysqld status
04 /etc/init.d/mysqld: line 256: my_print_defaults: command not found
05 MySQL running (21898)[  OK  ]
06 修改 /etc/init.d/mysqld 文件
07 编辑/etc/init.d/mysqld 46,47行basedir和datadir变量
08 [root@woyoo mysql]# service mysqld restart
09 Shutting down MySQL.[  OK  ]
10

Starting MySQL.[  OK  ]

你可能感兴趣的:(mysql,Linux,数据库)