首页 > 数据库 > MySQL > 正文

mysql装置

2024-07-24 12:31:40
字体:
来源:转载
供稿:网友
       mysql安装:

1、 安装环境
 
     CentOS Linux release 7.2.1511
 
     安装目录/application/
 
     安装方式:编译安装
 
     安装mysql版本:mysql-5.7.9
 
2、 安装依赖
 
1)安装依赖及工具
 
yum -y install make gcc-c++ cmake bison-devel  ncurses-devel perl vim wget
2)安装boost
 
下载安装boost:
 
wget -c https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz -P /tools
mkdir -p /usr/local/boost
cp /tools/boost_1_59_0.tar.gz /usr/local/boost
3、创建用户
 
useradd  mysql -s  /sbin/nologin -M
4、安装mysql
 
下载mysql
 
wget  -c https://downloads.mysql.com/archives/get/file/mysql-5.7.9.tar.gz -P /tools
cd /tools/ && tar -xf mysql-5.7.9.tar.gz
cd mysql-5.7.9
编译安装
 
cmake -DCMAKE_INSTALL_PREFIX=/application/mysql-5.7.9 -DMYSQL_DATADIR=/application/mysql-5.7.9/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=/usr/local/boost
make && make install
chown -R mysql:mysql /application/mysql-5.7.9   #修改权属
5、数据库初始化
 
cp support-files/my-default.cnf  /etc/my.cnf        #修改配置文件
cat>/etc/my.cnf<<EOF
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
 
support-files/mysql.server start                                                     #启动mysql
ln -s /application/mysql-5.7.9/ /application/mysql
6、修改环境变量
 
echo '#mysql'>>/etc/profile
echo 'PATH=${PATH}:/application/mysql/bin'>>/etc/profile
source /etc/profile

(编辑:武林网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表