这期内容当中小编将会给大家带来有关如何用RedHat 6.4源码方式安装mysql5.5,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
准备rpm包
yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
安装cmake
官网下载cmake,为绿色软件,添加环境变量后:
[root@ycr ~]# which cmake
/u02/cmake-3.6.1-Linux-x86_64/bin/cmake
安装boost
下载后解压,进入解压目录后运行
./booststrap之后运行./b2此过程耗时
安装ncurses-5.9.tar.gz
./configure
make
make install
解压安装包mysql-5.5.50
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \\
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \\
-DDEFAULT_CHARSET=utf8 \\
-DDEFAULT_COLLATION=utf8_general_ci \\
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \\
-DWITH_MYISAM_STORAGE_ENGINE=1 \\
-DWITH_INNOBASE_STORAGE_ENGINE=1 \\
-DWITH_MEMORY_STORAGE_ENGINE=1 \\
-DWITH_READLINE=1 \\
-DENABLED_LOCAL_INFILE=1 \\
-DMYSQL_DATADIR=/var/mysql/data \\
-DMYSQL_USER=mysql
运行完成后make和make install
chmod +w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
cp my-large.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysqld
vi /etc/my.cnf添加如下行
basedir = /usr/local/mysql
datadir = /usr/local/mysql 此处应该和下面的统一,不然会启动报错
log-error = /usr/local/mysql-5.5.14/mysql_error.log
pid-file = /usr/local/mysql-5.5.14/data/mysql.pid
default-storage-engine=MyISAM
user = mysql
mysql初始化,执行如下命令
/usr/local/mysql/scripts/mysql_install_db \\
–basedir=/usr/local/mysql \\ 此处应该和上面的统一,不然启动报错
–datadir=/var/mysql/data \\
–user=mysql
加入开机启动mysql
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqld添加如下行
basedir=/usr/local/mysql
datadir=/var/mysql/data
chkconfig –add mysqld
chkconfig –level 345 mysqld on
为MySQL配置环境变量,以后使用起来方便
# export PATH=/usr/local/mysql/bin:$PATH
启动mysql
service mysqld start
上述就是小编为大家分享的如何用RedHat 6.4源码方式安装mysql5.5了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注云搜网行业资讯频道。