编译安装Mysql5.5数据库软件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译安装Mysql5.5数据库软件相关的知识,希望对你有一定的参考价值。

准备环境:Centos6.5(6系列操作系统)

[[email protected] ~]# yum -y install gcc gcc-c++ ncurses-devel libxml2-devel zlib-devel pcre-devel

[[email protected] ~]# tar zxvf bison-2.5.tar.gz

[[email protected] ~]# cd bison-2.5

[[email protected] ~]# ./configure &&make &&make install

[[email protected] ~]# tar zxvf cmake-2.8.7.tar.gz

[[email protected] ~]# cd cmake-2.8.7

[[email protected] ~]# ./bootstrap &&gmake &&gmake install

[[email protected] ~]# tar zxvf mysql-5.5.22.tar.gz

[[email protected] ~]# cd mysql-5.5.22

[[email protected] ~]# useradd mysql

[[email protected] ~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc/ &&make &&make install

参数注释:安装目录、默认编码、校验字符集、安装所有扩展字符集、配置文件目录

[[email protected] ~]# chown -R :mysql /usr/local/mysql

[[email protected] ~]# cd /usr/local/mysql/support-files

[[email protected] ~]# cp my-medium.cnf /etc/my.cnf

[[email protected] ~]# cp mysql.server /etc/init.d/mysqld

[[email protected] ~]# cd ../scripts/


下面操作将进行mysql初始化,指定基础目录,存放数据目录,及运行用户

[[email protected] ~]# ./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql 

[[email protected] ~]# /etc/init.d/mysqld start

[[email protected] ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

[[email protected] ~]# source /etc/profile

[[email protected] ~]# mysqladmin -u root password ‘redhat‘  设置mysql运行账户及密码,这个root可不是系统用户的root哦!

[[email protected] ~]# mysql -u root -p

Enter password: 


OK,安装完成


本文出自 “11000174” 博客,请务必保留此出处http://11010174.blog.51cto.com/11000174/1901834

以上是关于编译安装Mysql5.5数据库软件的主要内容,如果未能解决你的问题,请参考以下文章

MySQL安装

mysql5.5手动编译安装及编译参数介绍

CentOS 6.8 编译安装MySQL5.5.32

用CentOS7.0编译安装Mysql5.5.32

mysql5.5的安装与配置(亲测版)

MySQL-5.6.34安装(centos7.2)