编译安装Mysql5.1.x并集成Sphinx(新手可直接一步一步照做,其他版本的稍改动即可)
如果需要就安装gcc
# rpm -ivh kernel-headers-2.6.18-53.el5.i386.rpm 
# rpm -ivh glibc-headers-2.5-18.i386.rpm 
# rpm -ivh glibc-devel-2.5-18.i386.rpm 
# rpm -ivh libgomp-4.1.2-14.el5.i386.rpm 
# rpm -ivh gcc-4.1.2-14.el5.i386.rpm 
# rpm -ivh libstdc++-devel-4.1.2-14.el5.i386.rpm 
# rpm -ivh gcc-c++-4.1.2-14.el5.i386.rpm   

如果需要就安装ncuses-devel-*.rpm
# rpm -ivh ncuses-devel-*.rpm

开始安装MySQL:

解压源代码文件及添加用户
# cd /home/mysql
# rpm -ivh MySQL-*.rpm
# groupadd my_term
# useradd -g my_term mysql
设置用户口令为
# passwd mysql
# tar zxvf mysql-5.1.51.tar.gz
# cp -R sphinx-0.9.9/mysqlse mysql-5.1.51/storage/sphinx

编译、链接、安装
# cd mysql-5.1.51
# yum install automake (可选,如果已经安装就不用执行)
# yum install libtool (可选,如果已经安装就不用执行)
# sh BUILD/autorun.sh
# yum install gcc*
# yum install make gcc
# yum -y install libtermcap-devel
# ./configure --prefix=/home/mysql/mysql --with-charset=utf8 --with-extra-charsets=all --with-client-ldflags=-all-static --with-mysqld-ldflags="-all-static" --enable-assembler --with-unix-socket-path=/home/mysql/mysql/tmp/mysql.sock --without-debug --with-mysqld-user=mysql --with-plugins=all CFLAGS="-O4" CXX=gcc CXXFLAGS="-O4 -felide-constructors -fno-exceptions -fno-rtti" --with-zlib-dir=bundled
# make
# make install
--with-zlib-dir=bundled(可选,如果已经安装zlib-devel包就不用)
--with-plugins=sphinx(可选)

复制配置和启动文件
# cp support-files/my-huge.cnf /etc/my.cnf
# cp support-files/mysql.server /home/mysql/mysql/bin/mysql.server
# cd /home/mysql/mysql/bin
# chmod +x mysql.server
# cp mysql.server /etc/rc.d/init.d/mysql.server

初始化
# ./mysql_install_db --user=mysql
# chown mysql.my_term /home/mysql/mysql/var
# chmod +wr /home/mysql/mysql/var
# chown -R mysql:my_term /home/mysql/mysql
# chown -R mysql:my_term /home/mysql/mysql/*
# ./mysqld_safe --user=mysql & 或者 ./mysql.server start
# ./mysql -uroot -p
mysql> use mysql;
mysql> update user set Host='%',Password=password('mypassword') where Host='127.0.0.1';
mysql> flush privileges;
mysql> quit;
# ./mysql.server stop

设置为后台服务
# /sbin/chkconfig --del mysql.server
# /sbin/chkconfig --add mysql.server

添加连接用户
GRANT select ON shop.* TO SQL_Server@'127.0.0.1';
GRANT all ON *.* TO web6@'192.168.0.6';
update mysql.user set Password=password('mypassword') where user like 'web%';

GRANT all ON shop.* TO Dfwgw_Shop@'127.0.0.1';
update user set Password=password('My_Shop') where user='Dfwgw_Shop';

GRANT select ON shop.* TO Green_Book@'127.0.0.1';
GRANT all ON laobook.* TO Green_Book@'127.0.0.1';
GRANT all ON htok_rss.* TO Green_Book@'127.0.0.1';
update user set Password=password('mypassword') where user='Green_Book';

刷新并优化
flush privileges
OPTIMIZE TABLE

配置主从复制(根据需要)
CHANGE MASTER TO MASTER_HOST='192.168.0.2',MASTER_PORT=6612,MASTER_USER='root',MASTER_PASSWORD='mypassword';
CHANGE MASTER TO master_log_file='mysql-bin.000035',master_log_pos=379032788;
slave start;
阅读更多
版权声明:本文为博主原创文章,博主允许自由转载。 https://blog.csdn.net/tx18/article/details/18560871
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

编译安装Mysql5.1.x并集成Sphinx(新手可直接一步一步照做,其他版本的稍改动即可)

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭