1、安装环境
2、安装依赖
3、创建用户
4、编译安装
5、数据库初始化
6、修改环境变量
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. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = ..... # port = ..... # server_id = ..... # socket = ..... basedir = /application/mysql-5.7.9 datadir = /application/mysql-5.7.9/data port = 3306 server_id = 1 socket = /tmp/mysql.sock # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M EOF cd /application/mysql-5.7.9 bin/mysqld --initialize --user=mysql --datadir=/application/mysql-5.7.9/data #初始化 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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。