二进制部署MySQL
程序员文章站
2022-07-02 21:50:31
[TOC] 1.MySQL安装前准备 1.1.安装依赖包 1.2.安装cmake 1.3.创建用户 2.MySQL下载安装 2.1.创建软件下载目录 2.2.下载并上传到/server/tools 2.3.解压 2.4.安装 3.配置并启动 3.1.创建软链接 3.2.拷贝配置文件到/etc 3.3 ......
1.mysql安装前准备
1.1.安装依赖包
yum install -y ncurses-devel libaio-devel
1.2.安装cmake
yum install cmake -y
1.3.创建用户
useradd -s /sbin/nologin -m mysql id mysql
2.mysql下载安装
2.1.创建软件下载目录
mkdir -p /server/tools cd /server/tools/
2.2.下载并上传到/server/tools
https://downloads.mysql.com/archives/community/
2.3.解压
cd /server/tools tar xf mysql-5.6.36.tar.gz
2.4.安装
cd mysql-5.6.36 cmake . -dcmake_install_prefix=/application/mysql-5.6.36 \ -dmysql_datadir=/application/mysql-5.6.36/data \ -dmysql_unix_addr=/application/mysql-5.6.36/tmp/mysql.sock \ -ddefault_charset=utf8 \ -ddefault_collation=utf8_general_ci \ -dwith_extra_charsets=all \ -dwith_innobase_storage_engine=1 \ -dwith_federated_storage_engine=1 \ -dwith_blackhole_storage_engine=1 \ -dwithout_example_storage_engine=1 \ -dwith_zlib=bundled \ -dwith_ssl=bundled \ -denabled_local_infile=1 \ -dwith_embedded_server=1 \ -denable_downloads=1 \ -dwith_debug=0 make && make install
3.配置并启动
3.1.创建软链接
ln -s /application/mysql-5.6.36/ /application/mysql
3.2.拷贝配置文件到/etc
cd /application/mysql cp support-files/my*.cnf /etc/my.cnf
3.3.初始化数据库
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
3.4.创建目录并授权
mkdir -p /application/mysql/tmp chown -r mysql.mysql /application/mysql/
3.5.复制启动脚本到/etc/init.d/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
3.6.启动数据库
/etc/init.d/mysqld start netstat -lntup|grep 330
3.7.配置环境变量
echo 'path=/application/mysql/bin/:$path' >>/etc/profile tail -1 /etc/profile source /etc/profile echo $path mysql
上一篇: C++的new和delete
下一篇: nginx反向代理配置及常见指令