标签:inf federated down class int 安装过程 grep password ref
以前一直使用过的是5.5和5.6,5.7的安装相对以前的版本在安装环节有一些区别,比如对boost包的依赖、初始化方式的改变等,这里简要记录一下5.7.24的安装过程:
[root@db02 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@db02 ~]# getenforce Disabled [root@db02 ~]# systemctl is-active firewalld.service unknown [root@db02 ~]# ip add |grep "inet "|grep eth|awk ‘{print $2}‘ 10.0.0.31/24 172.16.1.31/24 [root@db02 ~]# tail -1 /etc/hosts 10.0.0.31 db02
yum install -y gcc gcc-c++ automake autoconf yum -y install make cmake bison-devel ncurses-devel libaio-devel
##按照自己的习惯,放到自己存放安装包的目录下即可 [root@db02 ~]# cd /server/tools/ [root@db02 tools]# ls boost_1_59_0.tar.gz mysql-5.7.24.tar.gz
tar xf boost_1_59_0.tar.gz -C /usr/local/ tar -zxf mysql-5.7.24.tar.gz cd mysql-5.7.24/ cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.7.24 -DMYSQL_DATADIR=/application/mysql-5.7.24/data -DMYSQL_UNIX_ADDR=/application/mysql-5.7.24/tmp/mysql.sock -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost_1_59_0/boost -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_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_MYISAM_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 useradd -s /sbin/nologin -M mysql
ln -s /application/mysql-5.7.24/ /application/mysql chown -R mysql.mysql /application/mysql
/application/mysql-5.7.24/bin/mysqld --initialize --user=mysql --basedir=/application/mysql-5.7.24 --datadir=/application/mysql-5.7.24/data
注意:这个步骤会生成一个随机密码,一定要记录下来,第一次登陆数据库就靠它了
在其他版本的mysql 里,support-files下有会生成默认的配置文件my-default.cnf,可以按照套路复制到/etc下并重命名为my.cnf。但5.7.24没有这个文件,所以我们需要自己写一个,如下
[root@db02 mysql-5.7.24]# cat /etc/my.cnf [mysqld] basedir=/application/mysql datadir=/application/mysql/data port=3306 socket=/application/mysql/tmp/mysql.socket log-error=/application/mysql/mysql.error log_bin=/application/mysql/data/mysql/mysql-bin binlog_format=row server-id=1
skip-ssl [mysql] socket=/application/mysql/tmp/mysql.socket
根据上面配置,创建相应的目录或文件
mkdir /application/mysql/tmp chown -R mysql.mysql /application/mysql/tmp/ touch /application/mysql/mysql.error chown mysql.mysql /application/mysql/mysql.error
cp /application/mysql-5.7.24/support-files/mysql.server /etc/init.d/mysqld
echo ‘export PATH=/application/mysql/bin:$PATH‘ >>/etc/profile source /etc/profile
为了直观,直接将命令语句和标准输出记录如下:
###启动数据库 /etc/init.d/mysqld start ###登录 [root@db02 mysql-5.7.24]# mysql -uroot -p‘u3apH)waZ-Rl‘ ###修改密码(这时直接进行show等操作,会提示必须先修改密码) mysql> set password=password(‘123456‘); Query OK, 0 rows affected, 1 warning (0.00 sec)
至此,mysql5.7.24安装完毕
标签:inf federated down class int 安装过程 grep password ref
原文地址:https://www.cnblogs.com/Go-Spurs-Go/p/10496440.html