1、官网下载mysql
2、安装依赖包
yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio
yum install libaio libaio-devel -y
yum install perl-Data-Dumper -y
yum install net-tools -y
tar -zxvf mysql-5.6.40.tar.gz
cd mysql-5.6.40
# 创建mysql用户组
groupadd mysql
useradd -g mysql mysql
3、编译安装mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
3.1、执行初始化配置脚本
cd /usr/local/mysql
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
3.2、拷贝启动脚本并启动
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
service mysql start
4、登陆配置密码
vi /etc/profile
#在末尾添加
PATH=/usr/local/mysql/bin:$PATH
export PATH
source /etc/profile
mysql -u root -p
SET PASSWORD = PASSWORD(‘fan‘);
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘fan‘ WITH GRANT OPTION;
至此mysql编译安装完成。
原文地址:http://blog.51cto.com/243662875/2123108
时间: 2024-10-07 21:58:37