Home  >  Article  >  Database  >  MySQL 5.1.55 编译安装

MySQL 5.1.55 编译安装

WBOY
WBOYOriginal
2016-06-07 17:29:171113browse

版本:mysql-5.1 [root@localhost mysql-5.1.55]# useradd -M -s /sbin/nologin mysql [root@localhost media]# tar zxf mysql-5

版本:mysql-5.1

[root@localhost mysql-5.1.55]# useradd -M -s /sbin/nologin mysql
[root@localhost media]# tar zxf mysql-5.1.55.tar.gz -C /usr/src
[root@localhost media]# cd /usr/src/mysql-5.1.55/

接下来就是编译安装了

[root@localhost mysql-5.1.55]# ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=gbk,gb2312
这这里呢 我添加的参数比较简单 可以根据需要添加以下参数

--prefix=/usr/local/mysql //MySQL安装目录
--datadir=/mydata //数据库存放目录
--with-extra-charsets=gb2312 \添加gb2312中文字符支持
--with-charset=utf8 //使用UTF8格式
--without-debug \去除debug模式
--with-extra-charsets=complex //安装所有的扩展字符集
--enable-thread-safe-client //启用客户端安全线程
--with-big-tables //启用大表
--with-ssl //使用SSL加密
--with-embedded-server //编译成embedded MySQL library (libmysqld.a),
--enable-local-infile //允许从本地导入数据
--enable-assembler //汇编x86的普通操作符,可以提高性能
--with-plugins=innobase //数据库插件
--with-plugins=partition //分表功能,将一个大表分割成多个小表

我安装这的时候发现有报错

上网搜了一下,原来是curses/termcap 库没有安装需要下载一个ncurses 两种方法解决
 
1源码安装wget
tar zxvf ncurses-5.6.tar.gzcd ncurses-5.6./configure –prefix=/usr –with-shared –without-debugmakemake install clean
 
2 Yum安装:在这里我就直接yum安装了
yum -y install ncurses*
 
重新./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=gbk,gb2312
 
然后:[root@localhost mysql-5.1.55]# make
 [root@localhost mysql-5.1.55]# make install
 
安装后的调整和优化
[root@localhost mysql-5.1.55]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost mysql-5.1.55]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.1.55]# chmod +x /etc/init.d/mysqld
[root@localhost mysql-5.1.55]# chkconfig --add mysqld
[root@localhost mysql-5.1.55]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@localhost mysql-5.1.55]# ln -s /usr/local/mysql/lib/mysql/* /usr/lib
[root@localhost mysql-5.1.55]# ln -s /usr/local/mysql/include/mysql/* /usr/include/
初始化数据库
[root@localhost mysql-5.1.55]# cd /usr/local/mysql/bin/
[root@localhost bin]# ./mysql_install_db --user=mysql (初始化数据库)
[root@localhost bin]# chown -R root:mysql /usr/local/mysql/
[root@localhost bin]# chown -R mysql /usr/local/mysql/var/
启动Mysql服务
[root@localhost bin]# service mysqld start
Starting MySQL [确定]
 
查看一下mysql端口
[root@localhost mysql-5.1.55]# netstat -nutlp | grep mysqld
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 17432/mysqld
 
 
OK! 完成!

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn