一、安装依赖包和开发工具:

yum install vim vim-enhanced wget zip unzip telnet ntsysv compat* apr* nasm* gcc gcc* gcc-c++ ntp make imake cmake automake autoconf python-devel zlib zlib-devel glibc glibc-devel glib2 libxml glib2-devel libxml2 libxml2-devel bzip2 bzip2-devel libXpm libXpm-devel libidn libidn-devel libtool libtool-ltdl-devel* libmcrypt libmcrypt-devel libevent-devel libmcrypt* libicu-devel libxslt-devel postgresql-devel curl curl-devel perl perl-Net-SSLeay pcre pcre-devel ncurses ncurses-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers krb5 krb5-devel e2fsprogs e2fsprogs-devel libjpeg libpng libjpeg-devel libjpeg-6b libjpeg-devel-6b libpng-devel libtiff-devel freetype freetype-devel fontconfig-devel gd gd-devel kernel screen sysstat flex bison nss_ldap pam-devel compat-libstdc++-

二、清除系统中mysql痕迹:

yum remove mysql
rm -f /etc/my.cnf

三、创建mysql用户和用户组:

groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql

四、安装boost:

tar zxvf boost_1_60_0.tar.gz -C /usr/src
cd /usr/src/boost_1_60_0
./bootstrap.sh
./b2 --prefix=/usr/local
./b2 install

五、解压、配置、编译、安装mysql_5.7:

tar zxvf mysql-.tar.gz -C /usr/src
cd /usr/src/mysql-
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/home/mysql/data \
-DMYSQL_UNIX_ADDR=/home/mysql/pid/mysql.sock \
-DMYSQL_TCP_PORT= \
-DMYSQL_USER=mysql \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE= \
-DWITH_MYISAM_STORAGE_ENGINE= \
-DWITH_INNOBASE_STORAGE_ENGINE= \
-DWITH_ARCHIVE_STORAGE_ENGINE= \
-DWITH_BLACKHOLE_STORAGE_ENGINE= \
-DWITH_MEMORY_STORAGE_ENGINE= \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_EMBEDDED_SERVER= \
-DENABLED_LOCAL_INFILE= \
-DENABLE_DOWNLOADS= \
-DDOWNLOAD_BOOST= \
-DWITH_BOOST=/usr/local/include/boost
make && make install

六、编辑my.cnf配置文件:

cp /usr/src/mysql-/support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
[client]
port =
socket = /home/mysql/pid/mysql.sock
default-character-set = utf8

[mysql]
prompt="MySQL [\d]> "
no-auto-rehash
default-character-set = utf8

[mysqld]
port =
socket = /home/mysql/pid/mysql.sock
datadir = /home/mysql/data
pid-file = /home/mysql/pid/mysqld.pid
user = mysql
bind-address = 0.0.0.0
server-id =
init-connect = 'SET NAMES utf8'
character-set-server = utf8
skip-name-resolve
skip-external-locking
back_log =
lower_case_table_names =
ft_min_word_len =
performance_schema =
explicit_defaults_for_timestamp=true

max_connections =
max_connect_errors =
open_files_limit =
table_open_cache =
max_allowed_packet = 10M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 128M
read_buffer_size = 16M
read_rnd_buffer_size = 32M
sort_buffer_size = 16M
join_buffer_size = 8M
key_buffer_size = 256M
thread_cache_size =
query_cache_type =
query_cache_size = 256M
query_cache_limit = 2M

#log_bin = /home/mysql/log/mysql-bin
binlog_format = mixed
expire_logs_days =
log_error = /home/mysql/log/mysql_error.log
slow_query_log =
long_query_time =
slow_query_log_file = /home/mysql/log/mysql-slow.log

default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table =
innodb_open_files =
innodb_buffer_pool_size = 1024M
innodb_write_io_threads =
innodb_read_io_threads =
innodb_thread_concurrency =
innodb_purge_threads =
innodb_flush_log_at_trx_commit =
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group =
innodb_max_dirty_pages_pct =
innodb_lock_wait_timeout = 

bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 

interactive_timeout =
wait_timeout = 

[mysqldump]
quick
max_allowed_packet = 20M

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 32M
read_buffer = 16M
write_buffer = 16M

七、修改目录权限、生成新的mysql授权表:

mkdir -p /home/mysql/log
mkdir -p /home/mysql/data
chown -R mysql:mysql /home/mysql/
/usr/local/mysql/bin/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql --datadir=/home/mysql/data --basedir=/usr/local/mysql

八、添加mysqld系统服务:

cp /usr/src/mysql-/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level  mysqld on
chkconfig --list | grep mysqld

九、添加加载mysql库文件的路径:

echo /usr/local/mysql/lib >> /etc/ld.so.conf.d/mysql-x86_64.conf
echo /usr/lib64/mysql >> /etc/ld.so.conf.d/mysql-x86_64.conf
cp /etc/ld.so.conf.d/mysql-x86_64.conf  /etc/ld.so.conf.d/mysql.conf
ldconfig

十、链接可执行文件到系统环境变量:

ln -s /usr/local/mysql/lib/mysql /usr/lib64/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin/mysqladmin

十一、启动mysql服务:

service mysqld start
ps -aux | grep mysqld
netstat -anptu | grep 

十二、登录并修改mysql的root密码:

cat ~/.mysql_secret

# 查看mysql默认的初始密码

mysql -uroot -p 

# 输入.mysql_secret文件内的初始密码

set password for root@localhost = password('Passw0rd!');
grant all privileges on *.* to root@'%' identified by 'Passw0rd!';
update mysql.user set Grant_priv='Y' where Host='%';
flush privileges;

# "Passwrd!" 是修改的密码

十三、防火墙开启3306端口:
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

CentOS_7.2安装MySQL_5.7的更多相关文章

  1. Linux(CentOS_7.6)安装Nginx

    1.安装依赖 12 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel 2.下载Nginx并解压 1234567 c ...

  2. Linux安装MySQL_5.6

    E&T: CentOS_7.4 64位; mysql-5.6.42-linux-glibc2.12-x86_64.tar; Xftp5; Xshell5; P1.下载Linux环境下的MySQ ...

  3. CentOS_7.2安装Redis_3.0

    一.安装依赖包和开发工具: yum install vim vim-enhanced wget zip unzip telnet ntsysv compat* apr* nasm* gcc gcc* ...

  4. CentOS_7.2安装PHP_5.6

    一.安装依赖包和开发工具: yum install vim vim-enhanced wget zip unzip telnet ntsysv compat* apr* nasm* gcc gcc* ...

  5. CentOS_7.2安装Nginx_1.9

    一.安装依赖包和开发工具: yum install vim vim-enhanced wget zip unzip telnet ntsysv compat* apr* nasm* gcc gcc* ...

  6. win7_32位安装MySQL_5.6以及密码修改方法

    1.下载mysql: http://www.xiazaiba.com/html/361.html 2.安装 方便起见,全部默认下一步吧,原理一个样,最后安装到: 3.配置环境变量 我这里添加的是  C ...

  7. CentOS_7下安装PHP7.3

    安装mysql:https://www.cnblogs.com/jiangml/p/10402390.html 下载PHP安装包: 官网:http://www.php.net/downloads.ph ...

  8. CentOS_7下安装MySQL

    卸载旧版本MySQl: 下载MySQ: MySQl官网:https://dev.mysql.com/downloads/mysql/ 版本自选,操作系统选Linux-Generic,64位系统或者32 ...

  9. CentOS_7下安装Nginx服务

    安装make: yum -y install gcc automake autoconf libtool make make是一个命令工具,是一个解释makefile中指令的命令工具.它可以简化编译过 ...

随机推荐

  1. AES 与Base64加密

    public class AESHelper     {         /// <summary>         /// 获取密钥         /// </summary&g ...

  2. wf(五)

    测试工作流: 运用wf(四)的solution: 创建单元测试项目: 1.选择HelloWorkflow解决方案,右键选择添加新建项目:选择单元测试模板,命名为HelloWorkflow.Tests. ...

  3. xampp修改mysql默认密码详解

    在这里介绍xampp修改mysql默认密码的大概过程是先利用xampp的phpmyadmin进入修改mysql密码,修改之后我们再修改xampp中phpmyadmin的密码,这样就完整的修改mysql ...

  4. Xamarin.Forms listview中的button按钮,实现带着参数返回上一级页面

    今天在做列表显示的时候遇到一个问题,就是在ListView中如何才能让一个button的按钮工作并且包含参数呢? 其实有点类似于rep里的控件无法起获取一样.在Xamarin中,当你button绑定事 ...

  5. 大数据 > 数据平台方案评估

    分类 当前措施 说明 百度竞价如何进行数据分析(SEM工程师)数据来源: 1. 百度后台推广数据:api 总展现 总点击 点击率 总消费 点击均价 BDP功能点 1. 串联百度->网站商务通-& ...

  6. easyUI-combobox 动态绑定数据源

    前台 <link rel="stylesheet" type="text/css" href="../css/easyui.css"/ ...

  7. 《.Net 的冰与火之歌》寄雁传书,你必须知道的C#参数知识大盘点

    引言 参数,也叫参变量,是一个变量.在方法签名中随处可见,实现了不同方法间对于数据的寄雁传书,基本上充斥在代码的各个角落里.在方法签名或者原型中,方法名称后的括号包含方法的参数及其类型的完整列表.参数 ...

  8. 准备阶段-mongodb数据库安装

    具体安装步骤,请参阅 mongoDB(win7_64位)使用手册1.0

  9. consul模板的说明2

    保证模板的正常执行 使用||true $ consul-template -template "in.ctmpl:out.file:service nginx restart || true ...

  10. CSS与JavaScript的一些问题汇总

    通过最近的学习,总结了一些问题,可能总结得不够完善,但是好记性不如烂笔头,先记在这儿,后面看到更完整的回答,再进行修改. 1.事件流,如何阻止冒泡事件流:在点击一个按钮时,实则,按的父容器与按钮的父容 ...