1.环境:
linux5 + mysql-5.1.48.tar.gz
2.安装步骤如下:
2.1创建mysql 组及用户
shell>groupadd mysql
shell>useradd -g mysql mysql
2.2.mysql数据文件及数据库实例文件存放路径
shell>mkdir -p /opt/mysql/data
shell>chown -R mysql.mysql /opt/data
shell>mkdir -p /usr/local/mysql
2.3.解压及安装mysql tar 文件
shell>tar -zxvf mysql-5.1.48.tar.gz
shell>cd mysql-5.1.48.tar.gz
shell>./configure --prefix=/usr/local/mysql \ >
--without-debug >
--without-bench >
--enable-thread-safe-client >
--enable-assember >
--enable-profiling >
--with-mysqld-ldflags=-all-static >
--with-client-ldflags=-all-static >
--with-charset=latin1 >
--with-extra-charset=utf8,gbk >
--with-innodb >
--with-myisam >
--with-csv_storage-engine >
--with-federated-storage-engine >
--with-mysqld-user=mysql >
--without-embedded-server >
--with-server-suffix=-mark520
--with-unix-socket-path=/usr/local/mysql/sock/mysql.sock
--可以自行增减安装mysql选项。
2.4.安装mysql
shell>make;make install
2.5.修改配置文件
shell>cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf
shell>vi /etc/my.cnf 添加:
shell>basedir=/usr/local/mysql
shell>datadir=/opt/mysql/data
2.6.初始化数据库及生成系统表
shell>bin/mysql_install_db -defaults-file=/etc/my.cnf --user=mysql
备注:
configure 常用选项:
--prefix 设定安装路径,默认:/usr/local
--datadir 设定MySQL数据文件存放路径
--with-charset 设定系统默认字符集
--with-collation 系统默认的校验规则
--with-tcp-port 指定特定监听端口,默认为3306
--with-mysqld-user 指定运行mysqld 的 OS用户,默认为mysql
--without-query-cache 禁用Query Cache功能
--with-extra-charsets 出了默认字符集之外需要编译安装的字符集
--with-unix-socket-path 设定socket文件地址
--without-innodb 禁用Innodb存储引擎
--with-partition 在5.1版本中开启partition支持特性
--enable-thread-safe-client
以线程方式编译客户端
--with-pthread 强制使用pthread线程库编译
--with-named-thread-libs
指定使用某个特定的线程库编译
--without-debug 使用非debug模式
--with-mysqld-ldflags mysqld的额外link参数
--with-client-ldflags client的额外link参数
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26855487/viewspace-731623/
,如需转载,请注明出处,否则将追究法律责任。