useradd -s /usr/sbin/nologin -r mysql
下载源码包以及解压wget http://dev.mysql.com/get/Downloads/html' target='_blank'>MySQL-5.7/mysql-boost-5.7.21.tar.gztar -zxf mysql-boost-5.7.21.tar.gzcd mysql-5.7.21安装扩展依赖
yum remove mariadb-libsyum install gcc -yyum install gcc-c++ -yyum install cmake -yyum install libaio -yyum install ncurses-devel -y创建mysql的安装目录及数据库存放目录
mkdir -p /data/db/mysqlmkdir -p /data/log/mysql编译安装mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql /-DSYSCONFDIR=/usr/local/mysql/etc /-DMYSQL_DATADIR=/data/mysql /-DWITH_MYISAM_STORAGE_ENGINE=1 /-DWITH_INNOBASE_STORAGE_ENGINE=1 /-DWITH_PARTITION_STORAGE_ENGINE=1 /-DWITH_SYSTEMD=1 /-DWITH_SSL=system /-DWITH_ZLIB=system /-DWITH_EMBEDDED_SERVER=1 /-DENABLED_LOCAL_INFILE=1 /-DEXTRA_CHARSETS=all /-DDEFAULT_CHARSET=utf8mb4 /-DDEFAULT_COLLATION=utf8mb4_general_ci /-DDOWNLOAD_BOOST=1 /-DWITH_BOOST=/usr/local/boostmake -j8 make install检验是否安装成功
[root@root mysql-5.7.12]# cd /usr/local/mysql/[root@root mysql]# lsbin data include man mysql.sock.lock README support-filesCOPYING docs lib mysql.sock mysql-test share新建目录
mkdir -p /data/db/mysql/mkdir -p /data/log/mysql/增加配置文件
mkdir /usr/local/mysql/etctouch /usr/local/mysql/etc/my.cnfln -s /usr/local/mysql/etc/my.cnf /usr/local/etc修改权限
chown -R mysql:mysql /usr/local/mysql/*chown -R mysql:mysql /data/db/mysql /data/log/mysql生成初始化密码
cd /usr/local/mysqlbin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/db/mysqlbin/mysql_ssl_rsa_setupvim /data/log/mysql/error.log查看初始化密码grep temporary password /data/log/mysql/error.log将mysql的启动服务添加到系统服务中
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/systemmkdir -p /var/run/mysqld/chown mysql:mysql /var/run/mysqldsystemctl start mysqldservice mysql start启动mysql
service mysqld start检查mysql启动是否正常service mysqld status 或者 ps -ef | grep mysql设置mysqld服务开机自启动systemctl enable mysqld.service检查mysqld开机自启动是否设置成功systemctl list-dependencies | grep mysqld修改mysql密码,以及远程连接权限
ALTER USER root @ localhost IDENTIFIED BY Studytime% use mysql;select host, user from user;update user set host = % where user = root GRANT ALL PRIVILEGES ON *.* TO root @ % IDENTIFIED BY Studytime% WITH GRANT OPTION;FLUSH PRIVILEGES;
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP !
相关推荐:
PHP7.2 Data Structures的使用
php编译安装扩展redis及swoole的方法
以上就是linux编译安装mysql5.7的详细内容,PHP教程
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
新闻热点
疑难解答