标签:after 下载 inno blackhole download 依赖包 emc storage insecure
[root@localhost ~]#wget http://dev.mysql.com/Downloads/MySQL-5.7/mysql-5.7.12.tar.gz [root@localhost ~]#wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download
[root@localhost ~]#yum -y remove mysql-* boost-* [root@localhost ~]#rpm -qa mysql [root@localhost ~]#rpm -qa boost
[root@localhost ~]#yum -y install gcc gcc-c++ ncurses ncurses-devel bison libgcrypt perl cmake
[root@localhost ~]#tar -xf boost_1_59_0.tar.gz -C /usr/local/boost/
[root@localhost ~]#groupadd mysql [root@localhost ~]#useradd -r -g mysql mysql [root@localhost ~]#id mysql
[root@localhost ~]#tar -xf mysql-5.7.12.tar.gz -C /usr/src [root@localhost ~]#cd /usr/src/mysql-5.7.12
[root@localhost mysql-5.7.12]#cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost -DSYSCONFDIR=/etc [root@localhost mysql-5.7.12]#make && make install
可以make -j 来指定编译时用到的核心数来提高编译速度,如:指定用4个核心来安装:make -j 4
[root@localhost mysql-5.7.12]#chown -R mysql:mysql /usr/local/mysql #赋权 [root@localhost mysql-5.7.12]#cp /usr/src/mysql-5.7.12/support-files/my-default.cnf /etc/my.cnf #复制配置文件 [root@localhost mysql-5.7.12]#cp /usr/src/mysql-5.7.12/support-files/mysql.server /etc/init.d/ #复制启动脚本到系统服务目录下 [root@localhost mysql-5.7.12]#chmod +x /etc/init.d/mysql.server #添加可执行权限
编写服务控制脚本:
[root@localhost mysql-5.7.12]#cat <<END >>/usr/lib/systemd/system/mysqld.service [Unit] Description=mysqldapi After=network.target [Service] Type=forking PIDFile=/usr/local/mysql/logs/mysqld.pid ExecStart=/etc/init.d/mysql.server start ExecReload=/etc/init.d/mysql.server restart ExecStop=/etc/init.d/mysql.server stop PrivateTmp=Flase [Install] WantedBy=multi-user.target END [root@localhost mysql-5.7.12]#echo "export PATH=$PATH:/usr/local/mysql/bin/" >>/etc/profile && source /etc/profile #将MySQL的命令添加到环境变量 [root@localhost mysql-5.7.12]#mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data #初始化MySQL
修改MySQL配置文件:
[root@localhost mysql-5.7.12]#cat <<END >/etc/my.cnf [mysqld] basedir = /usr/local/mysql datadir = /usr/local/mysql/data port = 3306 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES character_set_server=utf8 init_connect=‘SET NAMES utf8‘ log-error=/usr/local/mysql/logs/mysqld.log pid-file=/usr/local/mysql/logs/mysqld.pid END [root@localhost mysql-5.7.12]#mkdir /usr/local/mysql/logs && chown mysql:mysql /usr/local/mysql/logs/ #创建MySQLlog文件并重新赋权 [root@localhost mysql-5.7.12]#systemctl start mysqld #启动服务 [root@localhost mysql-5.7.12]#systemctl enable mysqld #设置开机自启
[root@localhost mysql-5.7.12]#mysql #初始化之后默认没有密码,直接输入mysql就可以登陆了 [root@localhost mysql-5.7.12]#alter user ‘root‘@‘localhost‘ identified by ‘root‘; #修改密码
标签:after 下载 inno blackhole download 依赖包 emc storage insecure
原文地址:https://www.cnblogs.com/kjjmj/p/11066050.html