日期:2014-05-16  浏览次数:20607 次

linux mysql5.5.x 安装

1、下载mysql5.5.X对应的linux 平台版本:
???????? 官网: http://dev.mysql.com/downloads/os-linux.html ,选择对应的32或者64位平台版本。
???????? 通过个人博客 下载:? http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.3-m3.tar.gz

?

 wget  http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.3-m3.tar.gz

??? 现假设mysql文件下载在/data0/soft目录下:

?

[root@local soft]# ll
总用量 23044
-rw-r--r--. 1 root root 23595610 9月  24 18:46 mysql-5.5.3-m3.tar.gz
[root@local soft]# pwd
/data0/soft
?

?

2、添加mysql管理的linux账户:

?

groupadd mysql;
useradd -g mysql mysql;

?

3、编译安装,注意编译选项:

?

cd /data0/soft/mysql-5.5.3-m3/
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
make && make install
chmod +w /usr/local/webserver/mysql




chown -R mysql:mysql /usr/local/webserver/mysql




cd ../



?? prefix是数据库安装的目录,不然数据库默认安装到/usr/下各个角落。with-extra-charsets可以为complex /all /utf-8 / gbk? ,with-plugins添加实际mysql运行时需要的mysql插件。

?

?

4、创建mysql数据、日志文件存放目录:

mkdir -p /data0/mysql/3306/data/
mkdir -p /data0/mysql/3306/binlog/
mkdir -p /data0/mysql/3306/relaylog/
chown -R mysql:mysql /data0/mysql/

?

5、创建初始化数据库数据:

/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/data0/mysql/3306/data --user=mysql

?

6、创建mysql配置文件:

?

vi /data0/mysql/3306/my.cnf

?添加如下配置文件:

[client]
character-set-server = utf8
port    = 3306
socket  = /tmp/mysql.sock

[mysqld]
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
user    = mysql
port    = 3306
socket  = /tmp/mysql.sock
basedir = /usr/local/webserver/mysql
datadir = /data0/mysql/3306/data
log-error = /data0/mysql/3306/mysql_error.log
pid-file = /data0/mysql/3306/mysql.pid
open_files_limit    = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size